UNPKG

@backtrace/node

Version:
40 lines (39 loc) 1.11 kB
import EventEmitter from 'events'; import fs from 'fs'; import { NodeFileSystem } from '../storage/interfaces/NodeFileSystem.js'; import { ChunkSink } from './chunkifier.js'; interface FileChunkSinkOptions { /** * Maximum number of files. */ readonly maxFiles: number; /** * Full path to the chunk file. */ readonly file: (n: number) => string; /** * File system implementation to use. */ readonly fs: NodeFileSystem; } /** * Chunk sink which writes data to disk. * * Each time a new chunk is created, a new stream is created with path provided from options. */ export declare class FileChunkSink extends EventEmitter { private readonly _options; private readonly _streamTracker; /** * Returns all files that have been written to and are not deleted. */ get files(): readonly fs.WriteStream[]; constructor(_options: FileChunkSinkOptions); /** * Returns `ChunkSink`. Pass this to `chunkifier`. */ getSink(): ChunkSink<fs.WriteStream>; private createStream; private emitDeleteOrDelete; } export {};