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,
|
|
|
|
decode: decode
|
|
|
|
};
|