Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.15 KB

.template.md

File metadata and controls

53 lines (37 loc) · 1.15 KB

@airx/proto

最新版本号

npm

消息定义

<!-- PROTO -->

目录结构

<!-- SOURCE -->

Node.js

npm npm npm

安装

yarn add @airx/proto
# or
npm i --save @airx/proto

Encode/Decode 示例

const { Message } = require('@airx/proto');

// example code
const message = Message.create({ did: 'device1' });
const buffer = Message.encode(message).finish();
const decoded = Message.decode(buffer);

google.protobuf.Timestamp 示例

const timestamp = require('@airx/proto/timestamp');
const timestampObject = timestamp.set( new Date() );
// 返回 JSON Mapping 对象
const timestampFromObject = timestamp.get(timestampObject);
// 返回 Date Object

License

Apache 2.0