2014-06-04 19:52:08 +00:00
|
|
|
// Adapt encodings to work with Buffer or Uint8Array, they expect the latter
|
|
|
|
function decode(buf) {
|
2014-06-06 15:14:52 +00:00
|
|
|
return buf.toString('utf8');
|
2014-06-04 19:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function encode(string) {
|
2014-06-06 15:14:52 +00:00
|
|
|
return new Buffer(string, 'utf8');
|
2014-06-04 19:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
encode: encode,
|
2018-05-24 19:41:54 +00:00
|
|
|
decode: decode
|
2014-06-04 19:52:08 +00:00
|
|
|
};
|