UNPKG

iterparse

Version:
42 lines 1.7 kB
/// <reference types="node" /> import { ProgressReportOptions, WriteProgressReportOptions } from "./helpers"; import { AnyIterable, FileReference, IX } from "./types"; export interface BufferReadOptions extends FileReference, ProgressReportOptions { } /** * Function will read big files in memory efficient way. * @include ./BufferReadOptions.md * @example * import { bufferRead } from 'iterparse' * * bufferRead({ filePath: "path/to/file" }) * .map((buffer)=> console.log(buffer.byteLength)) * .count() * @example * import { bufferRead } from 'iterparse' * * for await (const buffer of bufferRead({ filePath: "path/to/file" })) { * console.log(q.byteLength) * } * @category Buffer */ export declare function bufferRead(options: BufferReadOptions): IX<Buffer>; export interface BufferWriteOptions extends FileReference, WriteProgressReportOptions { mode?: 'overwrite' | 'append'; } /** * Function will write buffer to file * @param data - Any iteratable that extends `AnyIteratable<string | Buffer>` type. * @example * import { AsyncIterable } from 'ix' * import { bufferWrite } from 'iterparse' * AsyncIterable.from(["one", "two", "three"]).pipe(bufferWrite({ filePath: "path/to/file" })) * @example * import { AsyncIterable } from 'ix' * import { bufferWrite } from 'iterparse' * bufferWrite(getBufferIter() ,{ filePath: "path/to/file" }).count() * @category Buffer */ export declare function bufferWrite(options: BufferWriteOptions): (data: AnyIterable<Buffer | string>) => IX<Buffer>; export declare function bufferWrite(data: AnyIterable<Buffer | string>, options: BufferWriteOptions): IX<Buffer>; //# sourceMappingURL=buffer.d.ts.map