diffusion
Version:
Diffusion JavaScript client
39 lines (38 loc) • 1.24 kB
JavaScript
;
/**
* @module Serialisers
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.BytesSerialiser = exports.BytesSerialiserClass = void 0;
var Codec = require("./../io/codec");
var BytesSerialiserClass = /** @class */ (function () {
function BytesSerialiserClass() {
}
/**
* Read a Uint8Array from a stream
*
* @param output the stream from which to read
* @return the value read from the stream if it is a valid enum value
*
* @throws an error if the value read is not a valid enum value
*/
BytesSerialiserClass.prototype.read = function (output) {
return Codec.readBytes(output);
};
/**
* Write a Uint8Array to a stream
*
* @param input the stream to which to write
* @param buffer the buffer of which is written
*/
BytesSerialiserClass.prototype.write = function (input, buffer) {
Codec.writeBytes(input, buffer);
};
return BytesSerialiserClass;
}());
exports.BytesSerialiserClass = BytesSerialiserClass;
/**
* The {@link BytesSerialiserClass} singleton
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
exports.BytesSerialiser = new BytesSerialiserClass();