UNPKG

json-type-cli

Version:

High-performance JSON Pointer implementation

22 lines (21 loc) 724 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CliCodecBson = void 0; const BsonDecoder_1 = require("@jsonjoy.com/json-pack/lib/bson/BsonDecoder"); const BsonEncoder_1 = require("@jsonjoy.com/json-pack/lib/bson/BsonEncoder"); class CliCodecBson { constructor(writer) { this.writer = writer; this.id = 'bson'; this.description = 'BSON: MongoDB binary format'; this.encoder = new BsonEncoder_1.BsonEncoder(writer); this.decoder = new BsonDecoder_1.BsonDecoder(); } encode(value) { return this.encoder.encode(value); } decode(bytes) { return this.decoder.read(bytes); } } exports.CliCodecBson = CliCodecBson;