filer/src/encoding.js

14 lines
257 B
JavaScript

// Adapt encodings to work with Buffer or Uint8Array, they expect the latter
function decode(buf) {
return buf.toString('utf8');
}
function encode(string) {
return new Buffer(string, 'utf8');
}
module.exports = {
encode: encode,
decode: decode
};