@36node/protocol-32960 中文文档教程
@36node/protocol-32960
电动汽车 32960 协议解析库
Install
yarn add @36node/protocol-32960
Usage
import Protocol from "@36node/protocol-32960";
// buffer: origin data
const protocol = new Protocol({
encrypt: { key: "xx", iv: "xxx", method: "AES128" },
});
const data = protocol.parse(buffer);
const buf = protocol.build(data);
cli
使用方法,可以全局安装或者用 npx 免安装执行
npx @36node/protocol-32960 parse -h
# Usage: parse [options]
# Parse binary message data
# Options:
# -d, --data <data> Binary hex data of message
# -i, --input <input> File contains binary hex data of message
# -d, --data <data> Binary hex data of message
# -o, --output <output> Save parsed result to file
# example:
npx @36node/protocol-32960 parse -d 232303fe4c53464430333230324a4330303136323701006b13020200210c81010002ff0300000423f5010002ff0300000423f3010002ff0300000423f3010002ff0300000423f3010002ff0300000423f3010002ff0300000423f6010002ff0300000423f5010002ff0300000423f5010002ff0300000423f3010002ff0300000423f30e
# 如果需要将结果拷贝到内存,可以通过管道
npx @36node/protocol-32960 parse -d xxxxxxxxxxxxxxx | pbcopy
# 通过文件输入输出
npx @36node/protocol-32960 parse -i ./some_in.file -o ./some_out.file
Protocol
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
module © 36node, Released under the MIT License.
Authored and maintained by 36node with help from contributors (list).
github.com/zzswang · GitHub @36node