30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.decode = decode;
|
|
exports.decodeMulti = decodeMulti;
|
|
const Decoder_ts_1 = require("./Decoder.cjs");;
|
|
/**
|
|
* It decodes a single MessagePack object in a buffer.
|
|
*
|
|
* This is a synchronous decoding function.
|
|
* See other variants for asynchronous decoding: {@link decodeAsync}, {@link decodeMultiStream}, or {@link decodeArrayStream}.
|
|
*
|
|
* @throws {@link RangeError} if the buffer is incomplete, including the case where the buffer is empty.
|
|
* @throws {@link DecodeError} if the buffer contains invalid data.
|
|
*/
|
|
function decode(buffer, options) {
|
|
const decoder = new Decoder_ts_1.Decoder(options);
|
|
return decoder.decode(buffer);
|
|
}
|
|
/**
|
|
* It decodes multiple MessagePack objects in a buffer.
|
|
* This is corresponding to {@link decodeMultiStream}.
|
|
*
|
|
* @throws {@link RangeError} if the buffer is incomplete, including the case where the buffer is empty.
|
|
* @throws {@link DecodeError} if the buffer contains invalid data.
|
|
*/
|
|
function decodeMulti(buffer, options) {
|
|
const decoder = new Decoder_ts_1.Decoder(options);
|
|
return decoder.decodeMulti(buffer);
|
|
}
|
|
//# sourceMappingURL=decode.cjs.map
|