///
/**
* The generic types idea was based on the MIT licensed project https://github.com/forbesmyester/stronger-typed-streams
* Originally published by Matt Forrester https://github.com/forbesmyester
* Types improved and additional features implemented by Roberto Sebestyen roberto@sebestyen.ca https://github.com/hiro5id
*/
import * as NodeStream from 'stream';
import { Duplex } from './stream-duplex-typed';
import { Writable } from './stream-writable-typed';
export declare abstract class Transform extends NodeStream.Transform {
'typechecking-field': In | undefined;
/**
* give this stream a name so that we can easily reference it in logs
* a common implementation would be:
* public readonly name: string = MyClass.name;
*/
abstract readonly name: string;
private readonly _baseTransform;
constructor(opts?: {});
push(chunk: Out | null, encoding?: BufferEncoding): boolean;
_transformEx(chunk: In, encoding: BufferEncoding, callback: (error?: Error | null, data?: any) => void): void;
/**
* A callback function (optionally with an error argument and data) to be called when remaining data has been flushed.
* This function MUST NOT be called by application code directly. It should be implemented by child classes, and called by the internal Readable class methods only.
*
* In some cases, a transform operation may need to emit an additional bit of data at the end of the stream. For example, a zlib compression stream will store an amount of internal state used to optimally compress the output. When the stream ends, however, that additional data needs to be flushed so that the compressed data will be complete.
*
* Custom Transform implementations may implement the transform._flush() method. This will be called when there is no more written data to be consumed, but before the 'end' event is emitted signaling the end of the Readable stream.
*
* Within the transform._flush() implementation, the readable.push() method may be called zero or more times, as appropriate. The callback function must be called when the flush operation is complete.
*
* The transform._flush() method is prefixed with an underscore because it is internal to the class that defines it, and should never be called directly by user programs.
*/
_flushEx(callback: (error?: Error | null, data?: any) => void): void;
/**
* This callback gets called when a NULL value comes through the stream indicating the end of the stream
* This optional function will be called before the stream closes, delaying the 'finish' event until callback is called. This is useful to close resources or write buffered data before a stream ends.
*/
_finalEx(callback: (error?: Error | null) => void): void;
pipe(destination: Duplex, options?: {
end?: boolean;
}): Duplex;
pipe(destination: Transform, options?: {
end?: boolean;
}): Transform;
pipe(destination: Writable, options?: {
end?: boolean;
}): Writable;
/**
* Syntactic sugar to easily add error handlers between pipe stages
* @param func - the error function
*/
err(func: (err: any) => void): Transform;
toPromiseFinish(): Promise;
_transform(chunk: In, encoding: BufferEncoding, callback: (error?: Error | null, data?: any) => void): void;
/**
* A callback function (optionally with an error argument and data) to be called when remaining data has been flushed.
* This function MUST NOT be called by application code directly. It should be implemented by child classes, and called by the internal Readable class methods only.
*
* In some cases, a transform operation may need to emit an additional bit of data at the end of the stream. For example, a zlib compression stream will store an amount of internal state used to optimally compress the output. When the stream ends, however, that additional data needs to be flushed so that the compressed data will be complete.
*
* Custom Transform implementations may implement the transform._flush() method. This will be called when there is no more written data to be consumed, but before the 'end' event is emitted signaling the end of the Readable stream.
*
* Within the transform._flush() implementation, the readable.push() method may be called zero or more times, as appropriate. The callback function must be called when the flush operation is complete.
*
* The transform._flush() method is prefixed with an underscore because it is internal to the class that defines it, and should never be called directly by user programs.
*/
_flush(callback: (error?: Error | null, data?: any) => void): void;
/**
* This callback gets called when a NULL value comes through the stream indicating the end of the stream
* This optional function will be called before the stream closes, delaying the 'finish' event until callback is called. This is useful to close resources or write buffered data before a stream ends.
*/
_final(callback: (error?: Error | null) => void): void;
}