@zenweb/msgpack
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

ZenWeb MessagePack Module

结果输出支持 MessagePack 格式

安装

npm install @zenweb/msgpack

快速使用

import { create } from 'zenweb';
import modMsgPack from '@zenweb/msgpack';

const app = create();

app.setup(modMsgPack());

app.start();

客户端调用

安装依赖

npm install msgpackr

调用事例

import { unpack } from 'msgpackr/unpack';

const data = await fetch('/api/some', {
  headers: {
    // 必须指定头信息
    Accept: 'application/x-msgpack',
  },
})
.then(res => res.arrayBuffer()) // 读取为 ArrayBuffer
.then(buf => unpack(buf)); // 使用 msgpackr 解码

Package Sidebar

Install

npm i @zenweb/msgpack

Weekly Downloads

195

Version

1.1.0

License

MIT

Unpacked Size

4.41 kB

Total Files

7

Last publish

Collaborators

  • yefei777