UNPKG

@cloudpss/ubjson

Version:

Opinionated UBJSON encoder/decoder for CloudPSS.

23 lines 638 B
import { StreamEncoderHelper } from '../stream-helper/encoder.js'; /** 流式编码 UBJSON */ export class EncodeTransformer { constructor(options) { this.helper = new StreamEncoderHelper(options, (binary) => { this.controller.enqueue(binary); }); } helper; controller; /** @inheritdoc */ transform(obj, controller) { this.controller = controller; this.helper.encode(obj); } /** @inheritdoc */ flush(controller) { this.controller = controller; this.helper.destroy(); controller.terminate(); } } //# sourceMappingURL=encoder.js.map