33 lines
8.1 KiB
JSON
33 lines
8.1 KiB
JSON
|
{
|
||
|
"author": {
|
||
|
"name": "https://github.com/pgriess"
|
||
|
},
|
||
|
"name": "jspack",
|
||
|
"description": "JavaScript library to pack primitives to octet arrays, packaged for NodeJS.",
|
||
|
"version": "0.0.3",
|
||
|
"homepage": "http://github.com/birchroad/node-jspack",
|
||
|
"repository": {
|
||
|
"type": "git",
|
||
|
"url": "git://github.com/birchroad/node-jspack.git"
|
||
|
},
|
||
|
"main": "./jspack.js",
|
||
|
"maintainers": [
|
||
|
{
|
||
|
"name": "Peter Magnusson",
|
||
|
"email": "peter@birchroad.net",
|
||
|
"url": "http://github.com/birchroad/node-jspack"
|
||
|
}
|
||
|
],
|
||
|
"readme": "jspack - library to pack primitives to octet arrays\n====================================================\n## Disclaimer\nThe jspack module and documentation are essentially ports of the\nPython struct module and documentation, with such changes as were necessary. The port was originaly made by Fair Oaks Labs, Inc. and published at http://code.google.com/p/jspack/\nIf any Python people are miffed that their documentation got ripped off, let me know,\nand I'll gladly revise them.\n\nThis module performs conversions between JavaScript values and C structs\nrepresented as octet arrays (i.e. JavaScript arrays of integral numbers\nbetween 0 and 255, inclusive). It uses format strings (explained below) as\ncompact descriptions of the layout of the C structs and the intended conversion\nto/from JavaScript values. This can be used to handle binary data stored in\nfiles, or received from network connections or other sources.\n\n## Install\n npm install jspack\n\n## Reference\n\nThe module defines the following functions:\n\n### Unpack(fmt, a, p)\nReturn an array containing values unpacked from the octet array a,\nbeginning at position p, according to the supplied format string. If there\nare more octets in a than required by the format string, the excess is\nignored. If there are fewer octets than required, Unpack() will return\nundefined. If no value is supplied for the p argument, zero is assumed.\n\n### PackTo(fmt, a, p, values)\nPack and store the values array into the supplied octet array a, beginning\nat position p. If there are more values supplied than are specified in the\nformat string, the excess is ignored. If there are fewer values supplied,\nPackTo() will return false. If there is insufficient space in a to store\nthe packed values, PackTo() will return false. On success, PackTo() returns\nthe a argument. If any value is of an inappropriate type, the results are\nundefined.\n\n### Pack(fmt, values)\nReturn an octet array containing the packed values array. If there are\nmore values supplied than are specified in the format string, the excess is\nignored. If there are fewer values supplied, Pack() will return false. If\nany value is of an inappropriate type, the results are undefined.\n\n### CalcLength(fmt)\nReturn the number of octets required to store the given format string.\n\n\n## Formats\nFormat characters have the following meanings; the conversion between C and\nJavaScript values should be obvious given their types:\n\n Format | C Type | JavaScript Type | Size (octets) | Notes\n -------------------------------------------------------------------\n A | char[] | Array | Length | (1)\n x | pad byte | N/A | 1 |\n c | char | string (length 1) | 1 | (2)\n b | signed char | number | 1 | (3)\n B | unsigned char | number | 1 | (3)\n h | signed short | number | 2 | (3)\n H | unsigned short | number | 2 | (3)\n i | signed long | number | 4 | (3)\n I | unsigned long | number | 4 | (3)\n l | signed long | number | 4 | (3)\n L | unsigned long | number | 4 | (3)\n q | signed quad | number | 8 | (3)\n Q | unsigned quad | number | 8 | (3)\n s | char[] | string | Length | (2)\n f | float | number | 4 | (4)\n d | double | number | 8 | (5)\nNotes:\n\n (1) The \"A\" code simply returns a slice of the source octet array. This is\n primarily useful when a data structure contains bytes which are subject to\n multiple intepretations (e.g. unions), and the data structure is being\n decoded in multiple passes.\n\n (2) T
|
||
|
"readmeFilename": "README.md",
|
||
|
"bugs": {
|
||
|
"url": "https://github.com/birchroad/node-jspack/issues"
|
||
|
},
|
||
|
"_id": "jspack@0.0.3",
|
||
|
"dist": {
|
||
|
"shasum": "12ad44317852796ced24cadc06c7b4986cf9809a"
|
||
|
},
|
||
|
"_from": "jspack@",
|
||
|
"_resolved": "https://registry.npmjs.org/jspack/-/jspack-0.0.3.tgz"
|
||
|
}
|