@push.rocks/smartstream
Version:
A library to simplify the creation and manipulation of Node.js streams, providing utilities for handling transform, duplex, and readable/writable streams effectively in TypeScript.
38 lines (37 loc) • 1.74 kB
TypeScript
/// <reference types="node" resolution-mode="require"/>
import * as plugins from './smartstream.plugins.js';
/**
* Creates a Web ReadableStream from a file.
*
* @param filePath - The path to the file to be read
* @returns A Web ReadableStream that reads the file in chunks
*/
export declare function createWebReadableStreamFromFile(filePath: string): ReadableStream<Uint8Array>;
/**
* Converts a Web ReadableStream to a Node.js Readable stream.
*
* @param webStream - The Web ReadableStream to convert
* @returns A Node.js Readable stream that reads data from the Web ReadableStream
*/
export declare function convertWebReadableToNodeReadable(webStream: ReadableStream<Uint8Array>): plugins.stream.Readable;
/**
* Converts a Node.js Readable stream to a Web ReadableStream.
*
* @param nodeStream - The Node.js Readable stream to convert
* @returns A Web ReadableStream that reads data from the Node.js Readable stream
*/
export declare function convertNodeReadableToWebReadable(nodeStream: plugins.stream.Readable): ReadableStream<Uint8Array>;
/**
* Converts a Web WritableStream to a Node.js Writable stream.
*
* @param webWritable - The Web WritableStream to convert
* @returns A Node.js Writable stream that writes data to the Web WritableStream
*/
export declare function convertWebWritableToNodeWritable(webWritable: WritableStream<Uint8Array>): plugins.stream.Writable;
/**
* Converts a Node.js Writable stream to a Web WritableStream.
*
* @param nodeWritable - The Node.js Writable stream to convert
* @returns A Web WritableStream that writes data to the Node.js Writable stream
*/
export declare function convertNodeWritableToWebWritable(nodeWritable: plugins.stream.Writable): WritableStream<Uint8Array>;