diff --git a/src/TileDBQuery/TileDBQuery.ts b/src/TileDBQuery/TileDBQuery.ts index 11e49ad..9095be9 100644 --- a/src/TileDBQuery/TileDBQuery.ts +++ b/src/TileDBQuery/TileDBQuery.ts @@ -147,6 +147,7 @@ export class TileDBQuery { undefined, undefined, { + cancelToken: options.cancelToken, headers: { 'Content-Type': 'application/capnp' }, @@ -210,7 +211,8 @@ export class TileDBQuery { ignoreOffsets: body.ignoreOffsets, attributes: body.attributes, returnOffsets: body.returnOffsets, - returnRawBuffers: body.returnRawBuffers + returnRawBuffers: body.returnRawBuffers, + cancelToken: body.cancelToken }; /** * Get the query response in capnp, we set responseType to arraybuffer instead of JSON @@ -227,6 +229,7 @@ export class TileDBQuery { undefined, undefined, { + cancelToken: body.cancelToken, headers: { 'Content-Type': 'application/capnp' }, diff --git a/src/utils/getResultsFromArrayBuffer.ts b/src/utils/getResultsFromArrayBuffer.ts index 32938ab..d2467d6 100644 --- a/src/utils/getResultsFromArrayBuffer.ts +++ b/src/utils/getResultsFromArrayBuffer.ts @@ -7,6 +7,7 @@ import setNullables from './setNullables'; import groupValuesByOffsetBytes from './groupValuesByOffsetBytes'; import concatChars from './concatChars'; import convertToArray from './convertToArray'; +import { CancelToken } from 'axios'; export interface Options { /** @@ -31,6 +32,10 @@ export interface Options { * Return offsets for every var-length attribute */ returnOffsets?: boolean; + /** + * CancelToken + */ + cancelToken?: CancelToken; } type Result =