{"id":19478862,"url":"https://github.com/xan105/node-addons","last_synced_at":"2026-01-27T07:36:14.203Z","repository":{"id":97594060,"uuid":"428131267","full_name":"xan105/node-addons","owner":"xan105","description":"ESM loader to integrate native code into Node.js with prebuild support","archived":false,"fork":false,"pushed_at":"2024-11-10T03:36:35.000Z","size":1271,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-04T21:39:00.877Z","etag":null,"topics":["bindings","esm","gyp","napi","native-module","nodejs","prebuild","wasi"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xan105.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"xan105","custom":"https://www.paypal.me/xan105","patreon":"xan105"}},"created_at":"2021-11-15T05:13:37.000Z","updated_at":"2024-11-10T03:36:38.000Z","dependencies_parsed_at":"2024-11-09T06:16:48.142Z","dependency_job_id":"c1aaca03-f38a-4598-9d14-b4c34c2b5546","html_url":"https://github.com/xan105/node-addons","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":"0.050000000000000044","last_synced_commit":"69302619efc0399c5ae27bdb1894fc476df8d7bf"},"previous_names":["xan105/node-gyp-load"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xan105/node-addons","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-addons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-addons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-addons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-addons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xan105","download_url":"https://codeload.github.com/xan105/node-addons/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-addons/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28808187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T07:14:39.408Z","status":"ssl_error","status_checked_at":"2026-01-27T07:14:39.098Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bindings","esm","gyp","napi","native-module","nodejs","prebuild","wasi"],"created_at":"2024-11-10T19:51:45.554Z","updated_at":"2026-01-27T07:36:14.186Z","avatar_url":"https://github.com/xan105.png","language":"JavaScript","funding_links":["https://github.com/sponsors/xan105","https://www.paypal.me/xan105","https://patreon.com/xan105"],"categories":[],"sub_categories":[],"readme":"About\n=====\n\nESM loader to integrate native code into Node.js with prebuild support.\n\nThis library helps dealing with finding and loading your bindings when using ESM.\n\nCurrently supports:\n\n- [ N-API ] Native addon\n- [ WASI ] WebAssembly System Interface\n\n📦 Scoped `@xan105` packages are for my own personal use but feel free to use them.\n\nNB: This library was previously named [node-gyp-load](https://www.npmjs.com/package/node-gyp-load)\n\nExample\n=======\n\n```js\nimport { dlopen } from \"@xan105/addons\";\n\nconst { foo } = await dlopen(\"bar.node\", {\n  cwd: import.meta.dirname\n});\n\nfoo();\n```\n\nCLI\n===\n\n## Prebuild (node-gyp)\n\nAdd `addons` as an install script to your native project:\n\n```json\n{\n  \"scripts\": {\n    \"install\": \"addons\"\n  }\n}\n```\n\nInstall script will check for prebuild(s) before building your project with `node-gyp rebuild`.\u003cbr /\u003e\nYou can force compile by doing `npm install --build-from-source`\n\nPrebuild(s) are expected to be found in the `prebuild` or `prebuilds` folder;\u003cbr /\u003e\nOrganized in subfolders \"platform-arch\".\u003cbr /\u003e\nThey should be N-API native addons with the `.node` file extension.\n\n_Example:_\n```\nMODULE_PATH/\n  -prebuilds/\n    -win32-x64/\n      -targetname.node\n      -targetname2.node\n    -win32-ia32/\n      -targetname.node\n      -targetname2.node\n```\n\nNB: Install script is also available with its old name `node-gyp-load` for backward compatibility.\n\n## SRI\n\nThis library API has an option to verify hash integrity using Subresource Integrity (SRI) string.\n\nAs such there is a convenience script named `addons-sri` to generate hash for every `.node` or `.wasm` files in the current working dir _(excluding node_modules)_.\n\n```json\n{\n  \"scripts\": {\n    \"sri\": \"addons-sri --algo sha384\"\n  }\n}\n```\n\nYou can specify the algo hash through the `--algo` argument; if omitted it defaults to `sha384`.\n\nAPI\n===\n\n⚠️ This module is only available as an ECMAScript module (ESM).\u003cbr /\u003e\n\n## Named export\n\n### `dlopen(filePath: string, option?: object): Promise\u003cunknown\u003e`\n\nFind and load specified addon based on its extention (.node, .wasm, ...).\n\n- When loading NAPI addons, if you only provide the bindings name (basename) this will automatically search the bindings in known locations such as `build/Release`, relative to the current working dir. You can change this directory using the `cwd` option.\n\n- When loading WASI addons, you can specify the WASI version with the option `version`.\n\n⚙️ **Options**\n\n+ `cwd?: string` (current working dir)\n\n  Current working dir where the node bindings is searched for.\n\n+ `version?: string` (preview1)\n\n  WASI version. Currently only `unstable` and `preview1` are available.\n\n+ `integrity?: string` (none)\n\n  Verify the addon hash against specified Subresource Integrity (SRI) string (eg: sha384-base64...).\n  \n  In case of NAPI gyp compilation _(= no prebuild)_ this check is skipped.\n\n## NAPI Namespace\n\n```js\nimport {} from \"@xan105/addons/napi\"\n```\n\n### `find(module: string, cwd: string): Promise\u003c{ path:string, isPrebuild: boolean }\u003e`\n\nFind node bindings by searching in known locations such as `build/Release`, relative to the specified current working dir.\n\n### `load(filePath: string): unknown`\n\nLoad specified node bindings.\n\n## WASI Namespace\n\n```js\nimport {} from \"@xan105/addons/wasi\"\n```\n\n### `const VERSION: string[]`\n\nWASI version available.\n\n### `load(filePath: string, version: string): Promise\u003cunknown\u003e`\n\nLoad specified WASI addon.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxan105%2Fnode-addons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxan105%2Fnode-addons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxan105%2Fnode-addons/lists"}