msgpack-lite 项目使用教程

msgpack-lite 项目使用教程

msgpack-liteFast Pure JavaScript MessagePack Encoder and Decoder / msgpack.org[JavaScript]项目地址:https://gitcode.com/gh_mirrors/ms/msgpack-lite

1. 项目的目录结构及介绍

msgpack-lite/
├── lib/
│   ├── codec/
│   ├── decode.js
│   ├── encode.js
│   ├── index.js
│   └── stream.js
├── test/
│   ├── decode-test.js
│   ├── encode-test.js
│   └── stream-test.js
├── .gitignore
├── .npmignore
├── LICENSE
├── package.json
├── README.md
└── yarn.lock
  • lib/: 包含项目的主要代码文件。
    • codec/: 包含编解码器的实现。
    • decode.js: 解码器的实现。
    • encode.js: 编码器的实现。
    • index.js: 项目的入口文件。
    • stream.js: 流处理的实现。
  • test/: 包含项目的测试文件。
    • decode-test.js: 解码器的测试文件。
    • encode-test.js: 编码器的测试文件。
    • stream-test.js: 流处理的测试文件。
  • .gitignore: Git 忽略文件配置。
  • .npmignore: npm 忽略文件配置。
  • LICENSE: 项目许可证。
  • package.json: 项目的 npm 配置文件。
  • README.md: 项目说明文档。
  • yarn.lock: Yarn 依赖锁定文件。

2. 项目的启动文件介绍

项目的启动文件是 lib/index.js,它是整个项目的入口点。该文件导出了编码和解码的功能,使得用户可以通过引入 msgpack-lite 包来使用这些功能。

// lib/index.js
module.exports = require("./encode");
module.exports.encode = require("./encode");
module.exports.decode = require("./decode");
module.exports.createEncodeStream = require("./stream").createEncodeStream;
module.exports.createDecodeStream = require("./stream").createDecodeStream;

3. 项目的配置文件介绍

项目的配置文件是 package.json,它包含了项目的基本信息、依赖项、脚本命令等。

{
  "name": "msgpack-lite",
  "version": "0.1.26",
  "description": "Fast Pure JavaScript MessagePack Encoder and Decoder",
  "main": "lib/index.js",
  "scripts": {
    "test": "mocha --reporter spec --bail --check-leaks test/",
    "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
    "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
    "benchmark": "node benchmark/benchmark-fast.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/kawanet/msgpack-lite.git"
  },
  "keywords": [
    "msgpack",
    "messagepack",
    "binary",
    "serialization",
    "encode",
    "decode"
  ],
  "author": "Yoshihiro Kawai <kawanet@gmail.com> (http://github.com/kawanet)",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/kawanet/msgpack-lite/issues"
  },
  "homepage": "https://github.com/kawanet/msgpack-lite",
  "dependencies": {
    "event-lite": "^0.1.1",
    "ieee754": "^1.1.8",
    "int64-buffer": "^0.1.10"
  },
  "devDependencies": {
    "benchmark": "^2.1.2",
    "istanbul": "^0.4.5",
    "mocha": "^3.2.0"
  }
}
  • name: 项目名称。
  • version: 项目版本。
  • description: 项目描述。
  • main: 项目的入口文件。
  • scripts: 项目脚本命令

msgpack-liteFast Pure JavaScript MessagePack Encoder and Decoder / msgpack.org[JavaScript]项目地址:https://gitcode.com/gh_mirrors/ms/msgpack-lite

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
/home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master/include/msgpack/v1/object.hpp:664:34: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘struct msgpack::v2::object’ from an array of ‘const msgpack_object’ {aka ‘const struct msgpack_object’} [-Werror=class-memaccess] std::memcpy(&o, &v, sizeof(v)); ^ In file included from /home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master/include/msgpack/object_fwd.hpp:17, from /home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master/include/msgpack/v1/adaptor/adaptor_base_decl.hpp:14, from /home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master/include/msgpack/adaptor/adaptor_base_decl.hpp:13, from /home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master/include/msgpack/adaptor/adaptor_base.hpp:13, from /home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master/include/msgpack/v1/object_decl.hpp:16, from /home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master/include/msgpack/object_decl.hpp:14, from /home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master/include/msgpack/object.hpp:13, from /home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master/include/msgpack.hpp:10, from /home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master/example/cpp03/stream.cpp:10: /home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master/include/msgpack/v2/object_fwd.hpp:23:8: note: ‘struct msgpack::v2::object’ declared here struct object : v1::object { ^~~~~~ cc1plus: all warnings being treated as errors make[2]: *** [example/cpp03/CMakeFiles/stream.dir/build.make:63:example/cpp03/CMakeFiles/stream.dir/stream.cpp.o] 错误 1 make[2]: 离开目录“/home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master” make[1]: *** [CMakeFiles/Makefile2:415:example/cpp03/CMakeFiles/stream.dir/all] 错误 2 make[1]: 离开目录“/home/AQTJClient/AQTJAuditClient/depends/msgpack-c-master”
07-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

惠淼铖

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值