All Projects → play175 → ByteBuffer

play175 / ByteBuffer

Licence: other
nodejs版本的ByteBuffer和C++通信的利器!

Programming Languages

HTML
75241 projects
javascript
184084 projects - #8 most used programming language
AngelScript
46 projects

Projects that are alternatives of or similar to ByteBuffer

Rubicon
Swift parser + mock generator
Stars: ✭ 42 (-40%)
Mutual labels:  protocol
MqttAndroidExample
An example Android app using MQTT protocol
Stars: ✭ 19 (-72.86%)
Mutual labels:  protocol
trinity-eth
No description or website provided.
Stars: ✭ 14 (-80%)
Mutual labels:  protocol
ErpNet.FP
ErpNet.FP is a light-weight cross-platform Http server facilitating printing to fiscal printers through simple JSON Api.
Stars: ✭ 75 (+7.14%)
Mutual labels:  protocol
WSD-python
Web Services for Devices (WSD) tools and utilities for cross platform support
Stars: ✭ 22 (-68.57%)
Mutual labels:  protocol
memcacher
C++ implementation of Memcache Binary Protocol.
Stars: ✭ 16 (-77.14%)
Mutual labels:  protocol
protocol-registry
This module allows you to set custom protocol handler for your nodejs app.
Stars: ✭ 45 (-35.71%)
Mutual labels:  protocol
ws-promise
A tiny, Promise-based WebSocket protocol allowing request-response usage in ECMAScript
Stars: ✭ 20 (-71.43%)
Mutual labels:  protocol
wayland-explorer
Easily browse and read Wayland protocols documentation
Stars: ✭ 78 (+11.43%)
Mutual labels:  protocol
kleros
Kleros smart contracts
Stars: ✭ 203 (+190%)
Mutual labels:  protocol
SwiftArchitectureWithPOP
A base architecture written in swift and protocol oriented, for building new apps easily and quickly
Stars: ✭ 28 (-60%)
Mutual labels:  protocol
metacom
RPC communication protocol for Metarhia stack 🔌
Stars: ✭ 42 (-40%)
Mutual labels:  protocol
nat-api
↔️ Fast port mapping with UPnP and NAT-PMP
Stars: ✭ 22 (-68.57%)
Mutual labels:  protocol
PSAVanCanBridge
VAN - CAN protocol bridge (V2C) for cars made by PSA Group (Peugeot, Citroen)
Stars: ✭ 67 (-4.29%)
Mutual labels:  protocol
GEO-network-client
Reference implementation of the GEO Protocol.
Stars: ✭ 19 (-72.86%)
Mutual labels:  protocol
LXFProtocolTool
由Swift中协议方式实现功能的实用工具库【Refreshable、EmptyDataSetable 支持 Rx 】
Stars: ✭ 101 (+44.29%)
Mutual labels:  protocol
rconsharp
rconsharp is a Valve RCON protocol implementation written in C# targeting netstandard 2.1
Stars: ✭ 43 (-38.57%)
Mutual labels:  protocol
protocol
Covee protocol for decentralized teamwork
Stars: ✭ 18 (-74.29%)
Mutual labels:  protocol
bytes-java
Bytes is a utility library that makes it easy to create, parse, transform, validate and convert byte arrays in Java. It supports endianness as well as immutability and mutability, so the caller may decide to favor performance.
Stars: ✭ 120 (+71.43%)
Mutual labels:  bytebuffer
sirdez
Glorious Binary Serialization and Deserialization for TypeScript.
Stars: ✭ 20 (-71.43%)
Mutual labels:  protocol

nodejs版本的ByteBuffer和C++通信的利器!

推荐结合ExBuffer来实现网络协议:https://github.com/play175/ExBuffer

var ByteBuffer = require('./ByteBuffer');

/*************************基本操作****************************/

//压包操作
var sbuf = new ByteBuffer();
var buffer = sbuf.string('abc123你好')//变长字符串,前两个字节表示长度
                       .int32(-999).uint32(999).float(-0.5)
                       .int64(9999999).double(-0.000005).short(32767).ushort(65535)
                       .byte(255)
                       .vstring('abcd',5)//定长字符串,不足的字节补0x00
                       .byteArray([65,66,67,68,69],5)//字节数组,不足字节补0x00
                       .pack();//结尾调用打包方法

console.log(buffer);

//解包操作
var rbuf = new ByteBuffer(buffer);
//解包出来是一个数组
var arr = rbuf.string()//变长字符串,前两个字节表示长度
                    .int32().uint32().float()
                    .int64().double().short().ushort()
                    .byte()
                    .vstring(null,5)//定长字符串,不足的字节补0x00
                    .byteArray(null,5)//字节数组,不足字节补0x00
                    .unpack();//结尾调用解包方法

console.log(arr);


/*************************更多操作****************************/

//指定字符编码(默认:utf8):utf8/ascii/
var sbuf = new ByteBuffer().encoding('ascii');

//指定字节序(默认:BigEndian)
var sbuf = new ByteBuffer().littleEndian();

//指定数据在二进制的初始位置 默认是0
var sbuf = new ByteBuffer(buffer,2);

//插入数据到指定位置
var sbuf = new ByteBuffer();
sbuf.int32(9999,0);//把这个int32数据插入到ByteBuffer的第一个位置

//在打包的时候在开始位置插入一个short型表示包长(通信层中的包头)
var buffer = sbuf.packWithHead();

install

npm install ByteBuffer -g
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].