-
Notifications
You must be signed in to change notification settings - Fork 6
/
README
34 lines (22 loc) · 874 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
HiPack
This is a copy of PHP's pack/unpack function made into a nodejs module.
Its a 100% clone with an additional options.
* A new feature where we can populate an existing Buffer is now there, so
* the caller can
worry about Buffer management. Simply make the first parameter a buffer
* Also we can supply an array of values, rather than arguments, so the 2nd
* parameter is an array.
ie. pack( "VV", [ 23,55 ] );
* Added a Perl style format that was missing, which is format character "V"
* and "v"
## Install
To install HiPack, use [npm](http://github.com/rauls/nodejs-pack)
$ npm install hipack
## Packing Bytes Test
To test packing bytes, run
$ node test/test.js
$ node test/speedtest.js
$ node example/packit.js CCCC 25 26 27 27
To use in code,
var pack = require( 'hipack' ).pack;
var buffer = pack( "CCCV", [ 1,2,3, 12345679 ] );