import CancellationToken from 'cancellationtoken'; import { Readable } from 'stream'; import { IDisposableObservable } from './IDisposableObservable'; export declare function writeAsync(stream: NodeJS.WritableStream, chunk: any): Promise; export declare function writeSubstream(stream: NodeJS.WritableStream): NodeJS.WritableStream; /** * Reads the next chunk from a stream, asynchronously waiting for more to be read if necessary. * @param stream The stream to read from. * @param cancellationToken A token whose cancellation will result in immediate rejection of the returned promise. * @returns The result of reading from the stream. This will be null if the end of the stream is reached before any more can be read. */ export declare function readAsync(stream: NodeJS.ReadableStream, cancellationToken?: CancellationToken): Promise; /** * Returns a readable stream that will read just a slice of some existing stream. * @param stream The stream to read from. * @param length The maximum number of bytes to read from the stream. * @returns A stream that will read up to the given number of bytes, leaving the rest in the underlying stream. */ export declare function sliceStream(stream: NodeJS.ReadableStream, length: number): Readable; /** * Returns a readable stream that reads a substream that was written with {@link writeSubstream}. * @param stream The stream to read the substream from. * @returns A stream that ends when the substream ends, leaving the rest of `stream` available to other readers. */ export declare function readSubstream(stream: NodeJS.ReadableStream): Readable; export declare function getBufferFrom(readable: NodeJS.ReadableStream, size: number, allowEndOfStream?: false, cancellationToken?: CancellationToken): Promise; export declare function getBufferFrom(readable: NodeJS.ReadableStream, size: number, allowEndOfStream: true, cancellationToken?: CancellationToken): Promise; export declare function throwIfDisposed(value: IDisposableObservable): void; export declare function requireInteger(parameterName: string, value: number, serializedByteLength: number, signed?: 'unsigned' | 'signed'): void; export declare function removeFromQueue(value: T, queue: T[]): void;