summaryrefslogtreecommitdiff
path: root/desktop/node_modules/dir-compare/build/src/fs/FileDescriptorQueue.d.ts
blob: c0dc67f3225ba40e60945059156ea8407f222183 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/// <reference types="node" />
import { NoParamCallback } from 'fs';
declare type OpenFileFlags = string | undefined;
declare type OpenFileCallback = (err: NodeJS.ErrnoException | null, fd: number) => void;
/**
 * Limits the number of concurrent file handlers.
 * Use it as a wrapper over fs.open() and fs.close().
 * Example:
 *  const fdQueue = new FileDescriptorQueue(8)
 *  fdQueue.open(path, flags, (err, fd) =>{
 *    ...
 *    fdQueue.close(fd, (err) =>{
 *      ...
 *    })
 *  })
 *  As of node v7, calling fd.close without a callback is deprecated.
 */
export declare class FileDescriptorQueue {
    private maxFilesNo;
    private activeCount;
    private pendingJobs;
    constructor(maxFilesNo: number);
    open(path: string, flags: OpenFileFlags, callback: OpenFileCallback): void;
    process(): void;
    close(fd: number, callback: NoParamCallback): void;
    openPromise(path: string, flags: OpenFileFlags): Promise<number>;
    closePromise(fd: number): Promise<void>;
}
export {};
//# sourceMappingURL=FileDescriptorQueue.d.ts.map