{"name":"ffi-napi","version":"4.0.3","license":"MIT","author":{"name":"Anna Henningsen","email":"anna@addaleax.net"},"contributors":[{"name":"Rick Branson","email":"rick@diodeware.com"},{"name":"Nathan Rajlich","email":"nathan@tootallnate.net"},{"name":"Gabor Mezo","email":"gabor.mezo@outlook.com"}],"description":"A foreign function interface (FFI) for Node.js, N-API style","keywords":["foreign","function","interface","ffi","libffi","binding","c","napi","stable"],"homepage":"http://github.com/node-ffi-napi/node-ffi-napi","engines":{"node":">=10"},"main":"./lib/ffi","dependencies":{"debug":"^4.1.1","get-uv-event-loop-napi-h":"^1.0.5","node-addon-api":"^3.0.0","node-gyp-build":"^4.2.1","ref-napi":"^2.0.1 || ^3.0.2","ref-struct-di":"^1.1.0"},"devDependencies":{"fs-extra":"^9.0.0","mocha":"^7.1.1","nyc":"^15.0.0","prebuildify":"^4.0.0","prebuildify-ci":"^1.0.5","ref-array-di":"^1.2.1"},"scripts":{"install":"node-gyp-build","prebuild":"prebuildify --napi --tag-armv --tag-uv","prepack":"prebuildify-ci download && ([ $(ls prebuilds | wc -l) = '5' ] || (echo 'Some prebuilds are missing'; exit 1))","test":"node-gyp rebuild --directory test && nyc mocha --expose-gc --reporter spec"},"repository":{"type":"git","url":"git+ssh://git@github.com/node-ffi-napi/node-ffi-napi.git"},"bugs":{"url":"http://github.com/node-ffi-napi/node-ffi-napi/issues"},"gitHead":"00df1232a25b1b0f026b5d1b4c9efc67497e4b48","_id":"ffi-napi@4.0.3","_nodeVersion":"14.15.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-PMdLCIvDY9mS32RxZ0XGb95sonPRal8aqRhLbeEtWKZTe2A87qRFG9HjOhvG8EX2UmQw5XNRMIOT+1MYlWmdeg==","shasum":"27a8d42a8ea938457154895c59761fbf1a10f441","tarball":"http://registry-npm.ywwl.com/ffi-napi/download/ffi-napi-4.0.3.tgz","fileCount":621,"unpackedSize":7275779,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgU1WbCRA9TVsSAnZWagAAuQ0P/2mHoOudMxOaGRdaOckF\nGKxUYR6GJMcNEH/z9d+QsmksYcgHbzd4jHYP5azB2uBZwZ0QK5+uZet1x8xw\nCOoSObLvQPEEvPrtKlwbR7SxRJXTY6KWENYiWQo3xLxcHVmttdXPEATqtKgZ\n6RiYDbyu0t44iIRPP85SedOEmAe5jp60MiIEPvLa2kXXIHq0xtIPSbAl161L\nT9kw7e6WvotSUPOrnU0Lx+JvTop9f2jrMTC9EAtQUvzkGLpOAefOSjuiMx5g\nd4iUzxhmfXBhTC0YGcPr/6uMIScwlOnSXtq/ar+zvlvJmgjCGRv7/bT6h03q\nwXYnqgp6Oc+3ctFFoYFdhu+2d0pStgb/XVDr2IpgcWmXLcplX6mKghIzThrz\nx5Z1HiWssEHQcrOHpvxkiy0+rePb+FkAMrl2Ce7RxhaWlQA8RVIu47VJTjjl\noXAK9mIaZEH8oO1ehZ/uu3j70k9EshqqoIDuSmogoNvTTSBBKlfszyuLaNQ6\nnRBSJ1n8mlGdwflF6hKUK5nLOsSfZs3HRQ3luRdQlLKB6v5pSdVRbIQli+KC\npMTC9f87uxfXBX3hF0vb87SLm0FaDbh4JBaxCcevdbxveY4mBqO7mBumIptZ\nA7the5Nh87WyzQsuPq4i/8WEjpRuWCms3rWKCDywjzkaSwTpdTnZIcmx4/m/\nUSoI\r\n=fKnD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCevev4lOzdhb6yvudBQegjPt6sfgsR4RFeJJOQzrRLEgIhANKv8xqh1cQPnN/0EWYrPI1IG6AO1nen0m04R6h8G7Iu"}],"size":1721485,"noattachment":false,"key":"/ffi-napi/-/ffi-napi-4.0.3.tgz"},"_npmUser":{"name":"addaleax","email":"anna@addaleax.net"},"directories":{},"maintainers":[{"name":"addaleax","email":"anna@addaleax.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ffi-napi_4.0.3_1616074138611_0.8191260162268514"},"_hasShrinkwrap":false,"readme":"node-ffi-napi\n=============\n### Node.js Foreign Function Interface for N-API\n[![Greenkeeper badge](https://badges.greenkeeper.io/node-ffi-napi/node-ffi-napi.svg)](https://greenkeeper.io/)\n\n[![NPM Version](https://img.shields.io/npm/v/ffi-napi.svg?style=flat)](https://npmjs.org/package/ffi-napi)\n[![NPM Downloads](https://img.shields.io/npm/dm/ffi-napi.svg?style=flat)](https://npmjs.org/package/ffi-napi)\n[![Build Status](https://travis-ci.org/node-ffi-napi/node-ffi-napi.svg?style=flat&branch=master)](https://travis-ci.org/node-ffi-napi/node-ffi-napi?branch=master)\n[![Coverage Status](https://coveralls.io/repos/node-ffi-napi/node-ffi-napi/badge.svg?branch=master)](https://coveralls.io/r/node-ffi-napi/node-ffi-napi?branch=master)\n[![Dependency Status](https://david-dm.org/node-ffi-napi/node-ffi-napi.svg?style=flat)](https://david-dm.org/node-ffi-napi/node-ffi-napi)\n\n`node-ffi-napi` is a Node.js addon for loading and calling dynamic libraries\nusing pure JavaScript. It can be used to create bindings to native libraries\nwithout writing any C++ code.\n\nIt also simplifies the augmentation of node.js with C code as it takes care of\nhandling the translation of types across JavaScript and C, which can add reams\nof boilerplate code to your otherwise simple C. See the `example/factorial`\nfor an example of this use case.\n\n**WARNING**: `node-ffi-napi` assumes you know what you're doing. You can pretty\neasily create situations where you will segfault the interpreter and unless\nyou've got C debugger skills, you probably won't know what's going on.\n\n**WARNING**: The original API of `node-ffi` is left mostly untouched in the\nN-API wrapper. However, the API did not have very well-defined properties\nin the context of garbage collection and multi-threaded execution. It is\nrecommended to avoid any multi-threading usage of this library\nif possible.\n\nExample\n-------\n\n``` js\nvar ffi = require('ffi-napi');\n\nvar libm = ffi.Library('libm', {\n  'ceil': [ 'double', [ 'double' ] ]\n});\nlibm.ceil(1.5); // 2\n\n// You can also access just functions in the current process by passing a null\nvar current = ffi.Library(null, {\n  'atoi': [ 'int', [ 'string' ] ]\n});\ncurrent.atoi('1234'); // 1234\n```\n\nFor a more detailed introduction, see the [node-ffi tutorial page][tutorial].\n\nRequirements\n------------\n\n * Linux, OS X, Windows, or Solaris.\n * `libffi` comes bundled with node-ffi-napi; it does *not* need to be installed on your system.\n * The current version is tested to run on Node 6 and above.\n\nInstallation\n------------\n\nMake sure you've installed all the [necessary build\ntools](https://github.com/TooTallNate/node-gyp#installation) for your platform,\nthen invoke:\n\n``` bash\n$ npm install ffi-napi\n```\n\nSource Install / Manual Compilation\n-----------------------------------\n\nTo compile from source it's easiest to use\n[`node-gyp`](https://github.com/TooTallNate/node-gyp):\n\n``` bash\n$ npm install -g node-gyp\n```\n\nNow you can compile `node-ffi-napi`:\n\n``` bash\n$ git clone git://github.com/node-ffi-napi/node-ffi-napi.git\n$ cd node-ffi\n$ node-gyp rebuild\n```\n\nTypes\n-----\n\nThe types that you specify in function declarations correspond to ref's types\nsystem. So [see its docs][ref-types] for\na reference if you are unfamiliar.\n\nV8 and 64-bit Types\n-------------------\n\nInternally, V8 stores integers that will fit into a 32-bit space in a 32-bit\ninteger, and those that fall outside of this get put into double-precision\nfloating point numbers. This is problematic because FP numbers are imprecise.\nTo get around this, the methods in node-ffi that deal with 64-bit integers return\nstrings and can accept strings as parameters.\n\nCall Overhead\n-------------\n\nThere is non-trivial overhead associated with FFI calls. Comparing a hard-coded\nbinding version of `strtoul()` to an FFI version of `strtoul()` shows that the\nnative hard-coded binding is orders of magnitude faster. So don't just use the\nC version of a function just because it's faster. There's a significant cost in\nFFI calls, so make them worth it.\n\nLicense\n-------\n\nMIT License. See the `LICENSE` file.\n\n[v1apichanges]: https://github.com/node-ffi/node-ffi/wiki/API-changes-from-v0.x-to-v1.x\n[tutorial]: https://github.com/node-ffi/node-ffi/wiki/Node-FFI-Tutorial\n[ref-types]: https://github.com/TooTallNate/ref#built-in-types\n","publish_time":1616074138751,"_cnpm_publish_time":1616074138751,"dist-tags":{"latest":"4.0.3"}}