{"_id":"erlpack","_rev":"8-82ab79119bd1c77ca63c6741e1adb91e","name":"erlpack","description":"Erlpack is a fast encoder and decoder for the Erlang Term Format (version 131) for JavaScript","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.0":{"main":"./js/index.js","name":"erlpack","version":"0.1.0","description":"Erlpack is a fast encoder and decoder for the Erlang Term Format (version 131) for Javascript","scripts":{"test":"jest","install":"node-gyp rebuild"},"author":{"name":"Jason Citron"},"license":"Apache-2.0","dependencies":{"bindings":"^1.2.1","nan":"^2.1.0"},"gypfile":true,"devDependencies":{"babel-jest":"^6.0.1","jest-cli":"^0.8.2"},"jest":{"scriptPreprocessor":"<rootDir>/node_modules/babel-jest","unmockedModulePathPatterns":["<rootDir>/build","<rootDir>/node_modules/bindings"]},"repository":{"type":"git","url":"git+https://github.com/hammerandchisel/erlpack.git"},"bugs":{"url":"https://github.com/hammerandchisel/erlpack/issues"},"homepage":"https://github.com/hammerandchisel/erlpack#readme","_id":"erlpack@0.1.0","_shasum":"b563af542ddfa1acff2603c7449f3bb381fe05ed","_from":".","_npmVersion":"4.1.2","_nodeVersion":"6.9.4","_npmUser":{"name":"kalissaac","email":"kalissaac@outlook.com"},"dist":{"shasum":"b563af542ddfa1acff2603c7449f3bb381fe05ed","tarball":"https://registry.npmjs.org/erlpack/-/erlpack-0.1.0.tgz","integrity":"sha512-44LKjFIHKV42m6qMSPdwLS3oGx2N//pGKZgPpXwi/XPRy1JeAeSdkHMyNrEnoBdlDiyGDscIh4IDGeX21nB4Wg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCeDfL0h/8KP8c5yRkBFi/FWsH50Rj0809izqzL+Y6vJgIhAJDb5fb8dtMYekWsSrsKey42OZxwQx7k98ko8JM/rqiE"}]},"maintainers":[{"name":"kalissaac","email":"kalissaac@outlook.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/erlpack-0.1.0.tgz_1487354435249_0.652676748810336"},"directories":{}},"0.1.1":{"main":"./js/index.js","name":"erlpack","version":"0.1.1","description":"Erlpack is a fast encoder and decoder for the Erlang Term Format (version 131) for Javascript","scripts":{"test":"jest","install":"node-gyp rebuild"},"author":{"name":"Jason Citron"},"license":"Apache-2.0","dependencies":{"bindings":"^1.2.1","nan":"^2.1.0"},"gypfile":true,"devDependencies":{"babel-jest":"^6.0.1","jest-cli":"^0.8.2"},"jest":{"scriptPreprocessor":"<rootDir>/node_modules/babel-jest","unmockedModulePathPatterns":["<rootDir>/build","<rootDir>/node_modules/bindings"]},"repository":{"type":"git","url":"git+https://github.com/hammerandchisel/erlpack.git"},"bugs":{"url":"https://github.com/hammerandchisel/erlpack/issues"},"homepage":"https://github.com/hammerandchisel/erlpack#readme","_id":"erlpack@0.1.1","_shasum":"e4d83889021d188b36d457a4952132ffa06a3715","_from":".","_npmVersion":"4.1.2","_nodeVersion":"6.9.4","_npmUser":{"name":"kalissaac","email":"kalissaac@outlook.com"},"dist":{"shasum":"e4d83889021d188b36d457a4952132ffa06a3715","tarball":"https://registry.npmjs.org/erlpack/-/erlpack-0.1.1.tgz","integrity":"sha512-EDrRKoSorfplCBnqrQlU73oZ2cC6B7f+adoyYSoombyMoNxl2wmX2y8EBPH3EgzDqCBWfKZksz7h4qLO+TTUlw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICZ24mrgkuQPX7QdPvuqmDCk/gpiPyR0bWLeoefwuLrzAiBeGr5kD83K0edrof1I0YmJaT9Y/j3Y3yp9nHmgzNBeIQ=="}]},"maintainers":[{"name":"kalissaac","email":"kalissaac@outlook.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/erlpack-0.1.1.tgz_1487355540127_0.16513402643613517"},"directories":{}},"0.1.2":{"main":"./js/index.js","name":"erlpack","version":"0.1.2","description":"Erlpack is a fast encoder and decoder for the Erlang Term Format (version 131) for Javascript","scripts":{"test":"jest","install":"node-gyp rebuild"},"author":{"name":"Jason Citron"},"license":"Apache-2.0","dependencies":{"bindings":"^1.2.1","nan":"^2.1.0"},"gypfile":true,"devDependencies":{"babel-jest":"^6.0.1","jest-cli":"^0.8.2"},"jest":{"scriptPreprocessor":"<rootDir>/node_modules/babel-jest","unmockedModulePathPatterns":["<rootDir>/build","<rootDir>/node_modules/bindings"]},"repository":{"type":"git","url":"git+https://github.com/hammerandchisel/erlpack.git"},"bugs":{"url":"https://github.com/hammerandchisel/erlpack/issues"},"homepage":"https://github.com/hammerandchisel/erlpack#readme","_id":"erlpack@0.1.2","_shasum":"cf1f4f755d0728ebc2d11b2e3c92bd2da834514e","_from":".","_npmVersion":"4.1.2","_nodeVersion":"6.9.4","_npmUser":{"name":"kalissaac","email":"kalissaac@outlook.com"},"dist":{"shasum":"cf1f4f755d0728ebc2d11b2e3c92bd2da834514e","tarball":"https://registry.npmjs.org/erlpack/-/erlpack-0.1.2.tgz","integrity":"sha512-CB1/ELoUVfHq4pUMHIG4zpc1zdUco/gstbw79Np7drURAwxfVZAx4oHUYzIWSIr6GPvwU0qvhrlo/oom9C1csQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDz6nfhTKdbsuTZs0Q5B5+RKEoyURJMXFjIPhcn8z4QqAIhAOWymQqAlFjTRQU27fJSou9dFfs8q3OvrmkkpYszo7KQ"}]},"maintainers":[{"name":"kalissaac","email":"kalissaac@outlook.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/erlpack-0.1.2.tgz_1487355888938_0.5289871161803603"},"directories":{}},"0.1.3":{"main":"./js/index.js","types":"./js/index.d.ts","name":"erlpack","version":"0.1.3","description":"Erlpack is a fast encoder and decoder for the Erlang Term Format (version 131) for JavaScript","scripts":{"test":"jest","install":"node-gyp rebuild"},"author":{"name":"Jason Citron"},"license":"MIT","dependencies":{"bindings":"^1.5.0","nan":"^2.14.0"},"gypfile":true,"devDependencies":{"@types/node":"^12.11.7","jest-cli":"^24.9.0"},"jest":{"unmockedModulePathPatterns":["<rootDir>/build","<rootDir>/node_modules/bindings"]},"repository":{"type":"git","url":"https://github.com/discordapp/erlpack.git"},"licenseText":"MIT License\n\nCopyright (c) 2017 Discord\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","_id":"erlpack@0.1.3","dist":{"shasum":"f6cd2a0d5b2f9d054b310c1dda98f60744b9f857","integrity":"sha512-QeG9v8CVsY/a/IoQi8zjn23aYKcziOihAxwjUl3tI/KB4R1FjTtctDAAMovgtpC16S+WiOauers2oWwIOQtKBQ==","tarball":"https://registry.npmjs.org/erlpack/-/erlpack-0.1.3.tgz","fileCount":291,"unpackedSize":2617846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdt0DGCRA9TVsSAnZWagAAkRwQAKRfYnP7DTklv2tgKl5m\nkUtiUb2CMRFzHgzx/9DElbLBrOnph+VgANR4TlVm+vvwXOs2zVgcymn087WB\nWu17Dl2Q14Y9er61vVX3ccoP9pF1Z6Zb+JXRDv0SVzNxJjinnLlvnfvevU9w\n38SduLyv0uCaPZhL6Yc214CVTMGddvxqNRNTgZZypAV5H7qYeYchr9S7AeBf\nMFXLNPyaTdZHbFz17XlmPsX0PGezH8TrVI7GcXzmBUPyV4PjAm0UfVz0ZzNT\nLJFKdec4HyWGQNflGcHqKWiw3aSPdVJIKUgk4GNoP7VeVbbmHvwqXkcvA1OU\nzv5+BbdH56ECKgS2h0qjsXk+z5sphwN2tGvFAZ93245PBjko77pp0W636f7W\nCZOCEdCTzKZqf6QlgGbStH/S0C6J72wCdcmV9CL/NgjkCaB7814cb5ADNmRs\n7ph2CgOnQgX4qdfeRGsPSixcrq7kij4b03S/ogfK3v8//RQseuTTfHMVPxZf\nuPdEJvRCkI9VBNr+ggKUT0YKFb/fHZ2n/2NZtT2ft3YvAOYy/e+D1cHsSBZ+\nn7Owo3Q13fov08qJ3JIcceqTPRjyEYZI05UUmnWntGkcDs3l/cXeYlO9dQdO\n1z9Qys/Lfz137KcKmlBk4fgzjfelWqPdQ5Cws/Ktd7LUCNjFXqz2zVkBoeMJ\nyGzW\r\n=OihB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC8kQbmDhJ/mv7etaAKnhIkWLRDRCPFtz+Hbjrz0HsQngIgA9jvpfCMaS6yTyhSLjas4yiBIWF/xuC+S7iw0wTwP7Q="}]},"maintainers":[{"email":"me@theak.io","name":"akio"}],"_npmUser":{"name":"akio","email":"me@theak.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/erlpack_0.1.3_1572290757735_0.8189956109760221"},"_hasShrinkwrap":false},"0.1.4":{"main":"./js/index.js","types":"./js/index.d.ts","name":"erlpack","version":"0.1.4","description":"Erlpack is a fast encoder and decoder for the Erlang Term Format (version 131) for JavaScript","scripts":{"test":"jest","install":"node-gyp rebuild"},"author":{"name":"Jason Citron"},"license":"MIT","dependencies":{"bindings":"^1.5.0","nan":"^2.15.0"},"gypfile":true,"devDependencies":{"@types/node":"^16.4.13","jest-cli":"^24.9.0"},"jest":{"unmockedModulePathPatterns":["<rootDir>/build","<rootDir>/node_modules/bindings"]},"repository":{"type":"git","url":"git+https://github.com/discord/erlpack.git"},"gitHead":"ddce6268a771f544313fb916f4041fecd89e2002","bugs":{"url":"https://github.com/discord/erlpack/issues"},"homepage":"https://github.com/discord/erlpack#readme","_id":"erlpack@0.1.4","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-CJYbkEvsB5FqCCu2tLxF1eYKi28PvemC12oqzJ9oO6mDFrFO9G9G7nNJUHhiAyyL9zfXTOJx/tOcrQk+ncD65w==","shasum":"018758a53206b8e9ba1f6c58a6766e3ba261a113","tarball":"https://registry.npmjs.org/erlpack/-/erlpack-0.1.4.tgz","fileCount":249,"unpackedSize":2618003,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhw03PCRA9TVsSAnZWagAAnxAP/14b6T33DpWdssvPgW3d\n9IYTlqrCJBLr9C1BG+n7g1LcuJHTID47R5sPyYkuij4+S065eZoceraot7UE\n+rRkr927so/DTIj259/FdZ9oFuKxAPUiv6Tz6TYs4XQDN7ED/oqm9lkSb4Db\nBQ6MNYi5TQThE9UcTYkfZSUrUXd1ocYzp9wOXjGJLcx+Ei3vVTIblv23z7rr\nV3uq6WE09TtXkeUmcRCOqUx4TFuzeSMII3dFbvr324PKt+Dc+Bkw8yFUtCt1\nTxkoP5DX51+ruSOEBzDFCn5j95esjyuglHNGS4C0cGZtTz+z14esWW6cmMpL\n7Aq3EC1gPytS3yrRsRFF8rShBK891YFcxNSu8232qGFKkBkoiJw4sUFD2Fx/\n5PBbqAhHVRYpDN/o+p7nfJ8To0XKreHNyrpDVwlB6sU/VXvhiMDeupuqu6sI\nnPDzlqEIBWh5Cu1srdUM6P1yuuh5L/A0TldWPei5R8/XjWRAHv69h1IPWFUI\npZbbmI1onfY92hUIZVjzLWSBoaS3uzjJalxYEKfHE/07ujyXvRM5RhEi8gFK\nYfIZux9vUqHIR/BFX/22nO2Ax1MOS0xl/cX5xRWeCjndCjbQvr9flvc5MLYd\njHlZRUK/SQ5HXpmr8Z5GdPArjDINpm9aGw00KARKBGBtDoOEMoTrV4m1Phvh\nf09Y\r\n=obKD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGBjKbZ4JWsWeqP7+7bGI3mEAO+lub1QQbi7rfp0WnmIAiAQjHjESisBalmeFTlBzr/P7skh/pXORyJM5nTGrloQLw=="}]},"_npmUser":{"name":"akio","email":"me@theak.io"},"directories":{},"maintainers":[{"name":"akio","email":"me@theak.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/erlpack_0.1.4_1640189391376_0.792074839510982"},"_hasShrinkwrap":false}},"readme":"# Erlpack\n\nErlpack is a fast encoder and decoder for the Erlang Term Format (version 131) for Python and JavaScript.\n\n# JavaScript\n\n## Things that can be packed:\n\n- [X] Null\n- [X] Booleans\n- [X] Strings\n- [ ] Atoms\n- [X] Unicode Strings\n- [X] Floats\n- [X] Integers\n- [ ] Longs\n- [ ] Longs over 64 bits\n- [X] Objects\n- [X] Arrays\n- [ ] Tuples\n- [ ] PIDs\n- [ ] Ports\n- [ ] Exports\n- [ ] References\n\n## How to pack:\n```js\nlet erlpack = require(\"erlpack\");\n\npacked = erlpack.pack({'a': true, 'list': ['of', 3, 'things', 'to', 'pack']});\n```\n\n## How to unpack:\nNote: Unpacking requires the binary data be a Uint8Array or Buffer. For those using electron/libchromium see the gotcha below. \n```js\nlet erlpack = require(\"erlpack\");\n\nlet unpacked = null;\nlet packed = new Buffer('', 'binary');\ntry  {\n    unpacked = erlpack.unpack(packed);\n}\ncatch (e) {\n    // got an exception parsing\n}\n```\n\n## Libchromium / Electron Gotcha\nSome versions of libchromium replace the native data type backing TypedArrays with a custom data type called \nblink::WebArrayBuffer. To keep erlpack' dependencies simple this data type is not supported directly. If you're using\nElectron / Libchromium you need to convert the blink::WebArrayBuffer into a node::Buffer before passing to erlpack. You will\nneed to add this code into your native package somewhere:\n```cpp\nv8::Local<v8::Value> ConvertToNodeBuffer(const v8::Local<v8::Object>& blinkArray)\n{\n    if (node::Buffer::HasInstance(blinkArray)) {\n        return blinkArray;\n    }\n    else if (blinkArray->IsArrayBufferView()) {\n        auto byteArray = v8::ArrayBufferView::Cast(*blinkArray);\n        return node::Buffer::Copy(v8::Isolate::GetCurrent(), (const char*)byteArray->Buffer()->GetContents().Data(), byteArray->ByteLength()).ToLocalChecked();\n    }\n    \n    return v8::Local<v8::Primitive>(v8::Null(v8::Isolate::GetCurrent()));\n}\n```\n\nThen in JavaScript something like:\n\n```js\nlet packed = NativeUtils.convertToNodeBuffer(new Uint8Array(binaryPayload));\n// unpack now using erlpack.unpack(packed)\n```\n\n# Python\n\n## Things that can be packed:\n\n- [X] None\n- [X] Booleans\n- [X] Strings\n- [X] Atoms\n- [X] Unicode Strings\n- [X] Floats\n- [X] Integers\n- [X] Longs\n- [ ] Longs over 64 bits\n- [X] Dictionaries\n- [X] Lists\n- [X] Tuples\n- [X] User Types (via an encode hook)\n- [ ] PIDs\n- [ ] Ports\n- [ ] Exports\n- [ ] References\n\n## How to pack:\n```py\nfrom erlpack import pack\n\npacked = pack([\"thing\", \"to\", \"pack\"])\n```\n\n## How to unpack:\n```py\nfrom erlpack import unpack\n\nunpacked = unpack(packed)\n```\n\n## How to pack an atom:\n\n```py\nfrom erlpack import Atom, pack\n\npacked = pack(Atom('hello'))\n```\n\n## How to use an encode hook.\n\n```py\nfrom erlpack import ErlangTermEncoder\n\ndef encode_hook(obj):\n    if isinstance(obj, datetime.datetime):\n        return obj.isoformat()\n\nencoder = ErlangTermEncoder(encode_hook=encode_hook)\npacked = encoder.pack(datetime.datetime(2015, 12, 25, 12, 23, 55))\n\n```\n\n## How to make custom types packable.\n\n```py\nfrom erlpack import pack, Atom\n\nclass User(object):\n    def __init__(self, name, age):\n        self.name = name\n        self.age = age\n\n    def __erlpack__(self):\n        return {\n            Atom('name'): self.name,\n            Atom('age'): self.age\n        }\n\nu = User(name='Jake', age=23)\npacked = pack(u)\n```\n\n# Go (golang)\n\nDiscord has moved away from Go internally and so we do not maintain a version of erlpack in Go ourselves. However, all is\nnot lost!, please check out: https://github.com/JakeMakesStuff/go-erlpack\n","maintainers":[{"name":"akio","email":"me@theak.io"}],"time":{"modified":"2022-06-17T08:03:44.243Z","created":"2017-02-17T18:00:35.491Z","0.1.0":"2017-02-17T18:00:35.491Z","0.1.1":"2017-02-17T18:19:00.371Z","0.1.2":"2017-02-17T18:24:49.183Z","0.1.3":"2019-10-28T19:25:57.943Z","0.1.4":"2021-12-22T16:09:51.561Z"},"repository":{"type":"git","url":"git+https://github.com/discord/erlpack.git"},"author":{"name":"Jason Citron"},"license":"MIT","readmeFilename":"README.md","homepage":"https://github.com/discord/erlpack#readme","bugs":{"url":"https://github.com/discord/erlpack/issues"}}