UNPKG

@betit/orion-node-sdk

Version:
30 lines 746 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const msgpack = require("msgpack-lite"); const utils_1 = require("../utils"); const DEBUG = utils_1.debugLog('orion:codec:msgpack'); /** * MessagePack, an efficient binary serialization format. */ class MsgPackCodec { constructor() { this.encoding = null; this.contentType = 'application/msgpack'; } /** * Encode data. */ encode(data) { DEBUG('encode'); return msgpack.encode(data); } /** * Decode data. */ decode(data) { DEBUG('decode'); return msgpack.decode(Buffer.from(data, 'binary')); } } exports.MsgPackCodec = MsgPackCodec; //# sourceMappingURL=msgpack.js.map