wechaty-grpc
Version:
gRPC for Wechaty
24 lines • 783 B
TypeScript
/**
* A stream transformer that encodes chunks into protobufs (and vice versa)
*/
import { Transform } from 'stronger-typed-streams';
import type { UploadRequest } from '../out/wechaty/puppet/download-upload_pb.js';
declare type Chunk = UploadRequest.AsObject['chunk'];
/**
* the interface for satisfyign UploadRequest & DownloadResponse
*/
interface ChunkPb {
getChunk(): Chunk;
setChunk(value: Chunk): void;
}
/**
* Wrap Chunk
*/
declare const chunkEncoder: <T extends ChunkPb>(PbConstructor: new () => T) => Transform<string | Uint8Array, T>;
/**
* Unwrap Chunk
*/
declare const chunkDecoder: <T extends ChunkPb>() => Transform<T, string | Uint8Array>;
export type { Chunk, };
export { chunkEncoder, chunkDecoder, };
//# sourceMappingURL=chunk-transformer.d.ts.map