pack / unpack functions for node.js [closed]

2019-01-08 18:59发布

Are there any modules that provide pack / unpack functionality for nodejs similar to python's struct module? I haven't found any specifically for node, and I'd assume that javascript implementations would be significantly slower.

Thanks.

3条回答
戒情不戒烟
2楼-- · 2019-01-08 19:08

https://github.com/pgriess/node-jspack appears to be a straight-up port of Python's struct API for packing binary data, but it's implemented in JS. It doesn't appear to be packaged for npm yet.

https://github.com/substack/node-binary provides unpacking, also implemented in JS, and you can install it with npm install binary if you have npm installed.

查看更多
男人必须洒脱
3楼-- · 2019-01-08 19:20

jBinary is another tool in this space which seems to be actively maintained (as of late 2014). It includes sample specifications for a variety of well-known formats, e.g. tar, ico and mp3.

查看更多
干净又极端
4楼-- · 2019-01-08 19:29
登录 后发表回答