| 1 |
/// <reference types="node" /> |
| 2 |
import { EventEmitter } from 'events'; |
| 3 |
import * as fsScandir from '@nodelib/fs.scandir'; |
| 4 |
import type Settings from '../settings'; |
| 5 |
import type { Entry, Errno } from '../types'; |
| 6 |
import Reader from './reader'; |
| 7 |
declare type EntryEventCallback = (entry: Entry) => void; |
| 8 |
declare type ErrorEventCallback = (error: Errno) => void; |
| 9 |
declare type EndEventCallback = () => void; |
| 10 |
export default class AsyncReader extends Reader { |
| 11 |
protected readonly _settings: Settings; |
| 12 |
protected readonly _scandir: typeof fsScandir.scandir; |
| 13 |
protected readonly _emitter: EventEmitter; |
| 14 |
private readonly _queue; |
| 15 |
private _isFatalError; |
| 16 |
private _isDestroyed; |
| 17 |
constructor(_root: string, _settings: Settings); |
| 18 |
read(): EventEmitter; |
| 19 |
get isDestroyed(): boolean; |
| 20 |
destroy(): void; |
| 21 |
onEntry(callback: EntryEventCallback): void; |
| 22 |
onError(callback: ErrorEventCallback): void; |
| 23 |
onEnd(callback: EndEventCallback): void; |
| 24 |
private _pushToQueue; |
| 25 |
private _worker; |
| 26 |
private _handleError; |
| 27 |
private _handleEntry; |
| 28 |
private _emitEntry; |
| 29 |
} |
| 30 |
export {}; |