erlang-term-format
v1.0.2
Published
Erlang External Term Format parser
Downloads
3
Readme
Erlang External Term Format
This module implements a parser for the External Term Format of Erlang.
Installation
$ npm install erlang-term-format
Usage
See test.js for some examples.
const Parser = require('erlang-term-format')
const parser = new Parser()
parser.on('readable', () => {
console.log(parser.read())
})
const pid = [
103, // 103 = PID type
100, 0x00, 0x03, 0x66, 0x6f, 0x6f, // atom 'foo'
0x00, 0x00, 0x00, 0x01, // id 1
0x00, 0x00, 0x00, 0x01, // serial 1
0x01 // creation 1
]
parser.write(new Buffer(pid))
// The following structure will be logged:
/*
{
name: 'pid',
value: {
node: {
name: 'atom',
value: {
atom: 'foo',
len: 3
}
},
id: 1,
serial: 1,
creation: 1
}
}
*/
Contributing
See CONTRIBUTING.md.