diff options
author | Minteck <nekostarfan@gmail.com> | 2021-08-24 14:41:48 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-08-24 14:41:48 +0200 |
commit | d25e11bee6ca5ca523884da132d18e1400e077b9 (patch) | |
tree | 8af39fde19f7ed640a60fb397c7edd647dff1c4c /node_modules/fastq/index.d.ts | |
download | kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.gz kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.bz2 kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.zip |
Initial commit
Diffstat (limited to 'node_modules/fastq/index.d.ts')
-rw-r--r-- | node_modules/fastq/index.d.ts | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/node_modules/fastq/index.d.ts b/node_modules/fastq/index.d.ts new file mode 100644 index 0000000..70311e7 --- /dev/null +++ b/node_modules/fastq/index.d.ts @@ -0,0 +1,36 @@ +declare function fastq<C, T = any, R = any>(context: C, worker: fastq.worker<C, T, R>, concurrency: number): fastq.queue<T, R> +declare function fastq<C, T = any, R = any>(worker: fastq.worker<C, T, R>, concurrency: number): fastq.queue<T, R> + +declare namespace fastq { + type worker<C, T = any, R = any> = (this: C, task: T, cb: fastq.done<R>) => void + type asyncWorker<C, T = any, R = any> = (this: C, task: T) => Promise<R> + type done<R = any> = (err: Error | null, result?: R) => void + type errorHandler<T = any> = (err: Error, task: T) => void + + interface queue<T = any, R = any> { + push(task: T, done?: done<R>): void + unshift(task: T, done?: done<R>): void + pause(): any + resume(): any + idle(): boolean + length(): number + getQueue(): T[] + kill(): any + killAndDrain(): any + error(handler: errorHandler): void + concurrency: number + drain(): any + empty: () => void + saturated: () => void + } + + interface queueAsPromised<T = any, R = any> extends queue<T, R> { + push(task: T): Promise<R> + unshift(task: T): Promise<R> + } + + function promise<C, T = any, R = any>(context: C, worker: fastq.asyncWorker<C, T, R>, concurrency: number): fastq.queueAsPromised<T, R> + function promise<C, T = any, R = any>(worker: fastq.asyncWorker<C, T, R>, concurrency: number): fastq.queueAsPromised<T, R> +} + +export = fastq |