{"id":18486477,"url":"https://github.com/yoshoku/hnswlib-node","last_synced_at":"2025-05-16T11:06:49.550Z","repository":{"id":42490665,"uuid":"463793147","full_name":"yoshoku/hnswlib-node","owner":"yoshoku","description":"hnswlib-node provides Node.js bindings for Hnswlib","archived":false,"fork":false,"pushed_at":"2025-05-09T02:00:54.000Z","size":968,"stargazers_count":109,"open_issues_count":14,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-09T22:47:10.407Z","etag":null,"topics":["approximate-nearest-neighbor-search","javascript","machine-learning","nearest-neighbor-search","nodejs","npm","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/hnswlib-node","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yoshoku.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2022-02-26T08:06:56.000Z","updated_at":"2025-04-18T20:47:47.000Z","dependencies_parsed_at":"2022-09-05T22:01:30.488Z","dependency_job_id":"b97977de-a003-4e12-a6fe-849f6c58a320","html_url":"https://github.com/yoshoku/hnswlib-node","commit_stats":{"total_commits":228,"total_committers":3,"mean_commits":76.0,"dds":0.4473684210526315,"last_synced_commit":"a6a67efc0530cab3bfd5202eb8fdc044e310f5a0"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoshoku%2Fhnswlib-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoshoku%2Fhnswlib-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoshoku%2Fhnswlib-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoshoku%2Fhnswlib-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yoshoku","download_url":"https://codeload.github.com/yoshoku/hnswlib-node/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518383,"owners_count":22084374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["approximate-nearest-neighbor-search","javascript","machine-learning","nearest-neighbor-search","nodejs","npm","typescript"],"created_at":"2024-11-06T12:49:27.500Z","updated_at":"2025-05-16T11:06:44.528Z","avatar_url":"https://github.com/yoshoku.png","language":"C++","funding_links":[],"categories":["SDKs \u0026 Libraries","C++"],"sub_categories":[],"readme":"# hnswlib-node\n\n[![npm version](https://badge.fury.io/js/hnswlib-node.svg)](https://badge.fury.io/js/hnswlib-node)\n[![Build Status](https://github.com/yoshoku/hnswlib-node/actions/workflows/build.yml/badge.svg)](https://github.com/yoshoku/hnswlib-node/actions/workflows/build.yml)\n[![License](https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg)](https://github.com/yoshoku/hnswlib-node/blob/main/LICENSE.txt)\n[![Documentation](https://img.shields.io/badge/api-reference-blue.svg)](https://yoshoku.github.io/hnswlib-node/doc/)\n\nhnswlib-node provides Node.js bindings for [Hnswlib](https://github.com/nmslib/hnswlib)\nthat implements approximate nearest-neghbor search based on\nhierarchical navigable small world graphs.\n\n## Installation\n\n```sh\n$ npm install hnswlib-node\n```\n\n## Documentation\n\n* [hnswlib-node API Documentation](https://yoshoku.github.io/hnswlib-node/doc/)\n* [How to run hnswlib-node on AWS Lambda](https://github.com/yoshoku/hnswlib-node/wiki/How-to-run-hnswlib-node-on-AWS-Lambda)\n\n## Usage\n\nGenerating search index:\n\n```typescript\nimport { HierarchicalNSW } from 'hnswlib-node';\n\nconst numDimensions = 8; // the length of data point vector that will be indexed.\nconst maxElements = 10; // the maximum number of data points.\n\n// declaring and intializing index.\nconst index = new HierarchicalNSW('l2', numDimensions);\nindex.initIndex(maxElements);\n\n// inserting data points to index.\nfor (let i = 0; i \u003c maxElements; i++) {\n  const point = new Array(numDimensions);\n  for (let j = 0; j \u003c numDimensions; j++) point[j] = Math.random();\n  index.addPoint(point, i);\n}\n\n// saving index.\nindex.writeIndexSync('foo.dat');\n```\n\nSearching nearest neighbors:\n\n```typescript\nimport { HierarchicalNSW } from 'hnswlib-node';\n\n// loading index.\nconst index = new HierarchicalNSW('l2', 3);\nindex.readIndexSync('foo.dat');\n\n// preparing query data points.\nconst numDimensions = 8;\nconst query = new Array(numDimensions);\nfor (let j = 0; j \u003c numDimensions; j++) query[j] = Math.random();\n\n// searching k-nearest neighbor data points.\nconst numNeighbors = 3;\nconst result = index.searchKnn(query, numNeighbors);\n\nconsole.table(result);\n```\n\n## License\n\nhnswlib-node is available as open source under the terms of the [Apache-2.0 License](https://www.apache.org/licenses/LICENSE-2.0).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/yoshoku/hnswlib-node.\nThis project is intended to be a safe, welcoming space for collaboration,\nand contributors are expected to adhere to the [Contributor Covenant](https://contributor-covenant.org) code of conduct.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoshoku%2Fhnswlib-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoshoku%2Fhnswlib-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoshoku%2Fhnswlib-node/lists"}