ErlpackJS is a fast encoder and decoder for the Erlang Term Format (version 131) for JavaScript based on erlpack supporting the browser and node.
$ yarn add erlpackjs
- Null
- Booleans
- Strings
- Atoms
- Unicode Strings
- Floats
- Integers
- Longs
- Longs over 64 bits
- Objects
- Arrays
- Tuples
- PIDs
- Ports
- Exports
- References
import { pack } from 'erlpackjs'; const packed = pack({ a: true, list: ['of', 3, 'things', 'to', 'pack'] }); console.log(packed);
Note: Unpacking requires the binary data be a Uint8Array or Buffer.
import { unpack } from 'erlpackjs'; const packed = Buffer.from('', 'binary'); let unpacked = null; try { unpacked = unpack(packed); console.log(unpacked); } catch (err) { // Got an exception parsing console.log(err); }