package.json
5.9 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{
"_args": [
[
{
"raw": "ref-struct@>= 0.0.5",
"scope": null,
"escapedName": "ref-struct",
"name": "ref-struct",
"rawSpec": ">= 0.0.5",
"spec": ">=0.0.5",
"type": "range"
},
"/Users/fzy/project/koa2_Sequelize_project/node_modules/win32api"
]
],
"_from": "ref-struct@>=0.0.5",
"_id": "ref-struct@1.1.0",
"_inCache": true,
"_location": "/ref-struct",
"_nodeVersion": "4.4.5",
"_npmOperationalInternal": {
"host": "packages-16-east.internal.npmjs.com",
"tmp": "tmp/ref-struct-1.1.0.tgz_1470198399420_0.7703484199009836"
},
"_npmUser": {
"name": "tootallnate",
"email": "nathan@tootallnate.net"
},
"_npmVersion": "2.15.5",
"_phantomChildren": {},
"_requested": {
"raw": "ref-struct@>= 0.0.5",
"scope": null,
"escapedName": "ref-struct",
"name": "ref-struct",
"rawSpec": ">= 0.0.5",
"spec": ">=0.0.5",
"type": "range"
},
"_requiredBy": [
"/ffi",
"/win32api",
"/win32ole"
],
"_resolved": "https://registry.npmjs.org/ref-struct/-/ref-struct-1.1.0.tgz",
"_shasum": "5d5ee65ad41cefc3a5c5feb40587261e479edc13",
"_shrinkwrap": null,
"_spec": "ref-struct@>= 0.0.5",
"_where": "/Users/fzy/project/koa2_Sequelize_project/node_modules/win32api",
"author": {
"name": "Nathan Rajlich",
"email": "nathan@tootallnate.net",
"url": "http://tootallnate.net"
},
"bugs": {
"url": "https://github.com/TooTallNate/ref-struct/issues"
},
"dependencies": {
"debug": "2",
"ref": "1"
},
"description": "Create ABI-compliant \"struct\" instances on top of Buffers",
"devDependencies": {
"bindings": "~1.2.0",
"mocha": "*",
"nan": "2",
"ref-array": "~1.1.2"
},
"directories": {},
"dist": {
"shasum": "5d5ee65ad41cefc3a5c5feb40587261e479edc13",
"tarball": "https://registry.npmjs.org/ref-struct/-/ref-struct-1.1.0.tgz"
},
"gitHead": "a4432a0cae3e5538b225a3556bed9a97f406fae6",
"homepage": "https://github.com/TooTallNate/ref-struct#readme",
"keywords": [
"struct",
"ref",
"abi",
"c",
"c++",
"ffi"
],
"license": "MIT",
"main": "./lib/struct.js",
"maintainers": [
{
"name": "tootallnate",
"email": "nathan@tootallnate.net"
}
],
"name": "ref-struct",
"optionalDependencies": {},
"readme": "ref-struct\n==========\n### Create ABI-compliant \"[struct][]\" instances on top of Buffers\n[](https://travis-ci.org/TooTallNate/ref-struct)\n[](https://ci.appveyor.com/project/TooTallNate/ref-struct)\n\n\nThis module offers a \"struct\" implementation on top of Node.js Buffers\nusing the ref \"type\" interface.\n\nInstallation\n------------\n\nInstall with `npm`:\n\n``` bash\n$ npm install ref-struct\n```\n\n\nExamples\n--------\n\nSay you wanted to emulate the `timeval` struct from the stdlib:\n\n``` c\nstruct timeval {\n time_t tv_sec; /* seconds since Jan. 1, 1970 */\n suseconds_t tv_usec; /* and microseconds */\n};\n```\n\n``` js\nvar ref = require('ref')\nvar StructType = require('ref-struct')\n\n// define the time types\nvar time_t = ref.types.long\nvar suseconds_t = ref.types.long\n\n// define the \"timeval\" struct type\nvar timeval = StructType({\n tv_sec: time_t,\n tv_usec: suseconds_t\n})\n\n// now we can create instances of it\nvar tv = new timeval\n```\n\n#### With `node-ffi`\n\nThis gets very powerful when combined with `node-ffi` to invoke C functions:\n\n``` js\nvar ffi = require('ffi')\n\nvar tv = new timeval\ngettimeofday(tv.ref(), null)\n```\n\n#### Progressive API\n\nYou can build up a Struct \"type\" incrementally (useful when interacting with a\nparser) using the `defineProperty()` function. But as soon as you _create_ an\ninstance of the struct type, then the struct type is finalized, and no more\nproperties may be added to it.\n\n``` js\nvar ref = require('ref')\nvar StructType = require('ref-struct')\n\nvar MyStruct = StructType()\nMyStruct.defineProperty('width', ref.types.int)\nMyStruct.defineProperty('height', ref.types.int)\n\nvar i = new MyStruct({ width: 5, height: 10 })\n\nMyStruct.defineProperty('weight', ref.types.int)\n// AssertionError: an instance of this Struct type has already been created, cannot add new \"fields\" anymore\n// at Function.defineProperty (/Users/nrajlich/ref-struct/lib/struct.js:180:3)\n```\n\n\nLicense\n-------\n\n(The MIT License)\n\nCopyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[struct]: http://wikipedia.org/wiki/Struct_(C_programming_language)\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git://github.com/TooTallNate/ref-struct.git"
},
"scripts": {
"test": "node-gyp rebuild --directory test && mocha -gc --reporter spec"
},
"version": "1.1.0"
}