protoobject
Version:
A universal class for creating any JSON objects and simple manipulations with them.
38 lines (37 loc) • 1.57 kB
TypeScript
/**
* ProtoObjectStream - Streaming utilities for ProtoObject using @sergdudko/objectstream
* @description Provides methods for efficient streaming serialization and deserialization
* @author Siarhei Dudko <siarhei@dudko.dev>
*/
import { Transform } from "node:stream";
/**
* Utility class for streaming ProtoObject serialization using @sergdudko/objectstream
*/
export declare class ProtoObjectStream {
/**
* Create a transform stream that converts ProtoObject instances to Buffer
* @returns Transform stream for object-to-buffer conversion
*/
static createObjectToBufferStream(): Transform;
/**
* Create a transform stream that converts Buffer to ProtoObject instances
* @param objectClass - The ProtoObject class constructor
* @returns Transform stream for buffer-to-object conversion
*/
static createBufferToObjectStream<T>(objectClass: new (data?: any) => T): Transform;
/**
* Create a complete serialization pipeline
* @param objectClass - The ProtoObject class constructor
* @returns Object with serialize and deserialize transforms
*/
static createSerializationPipeline<T>(objectClass: new (data?: any) => T): {
serialize: Transform;
deserialize: Transform;
};
/**
* Create a bidirectional stream for two-way communication
* @param objectClass - The ProtoObject class constructor
* @returns Transform stream for bidirectional communication
*/
static createBidirectionalStream<T>(objectClass: new (data?: any) => T): Transform;
}