{"id":15698894,"url":"https://github.com/doowb/ngraph.frombinary","last_synced_at":"2025-05-09T02:14:18.220Z","repository":{"id":65990624,"uuid":"72904645","full_name":"doowb/ngraph.frombinary","owner":"doowb","description":"Deserialize an ngraph.graph from binary format.","archived":false,"fork":false,"pushed_at":"2016-11-05T04:19:24.000Z","size":12,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-09T02:14:13.287Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/doowb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"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},"funding":{"github":["doowb","jonschlinkert"]}},"created_at":"2016-11-05T04:16:57.000Z","updated_at":"2024-01-19T17:17:27.000Z","dependencies_parsed_at":"2023-02-28T11:15:38.224Z","dependency_job_id":null,"html_url":"https://github.com/doowb/ngraph.frombinary","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"5d38cefd6b0e25d004723c3b911868de2ed7a382"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fngraph.frombinary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fngraph.frombinary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fngraph.frombinary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fngraph.frombinary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doowb","download_url":"https://codeload.github.com/doowb/ngraph.frombinary/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253176444,"owners_count":21866143,"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":[],"created_at":"2024-10-03T19:35:46.220Z","updated_at":"2025-05-09T02:14:18.202Z","avatar_url":"https://github.com/doowb.png","language":"JavaScript","funding_links":["https://github.com/sponsors/doowb","https://github.com/sponsors/jonschlinkert"],"categories":[],"sub_categories":[],"readme":"# ngraph.frombinary [![NPM version](https://img.shields.io/npm/v/ngraph.frombinary.svg?style=flat)](https://www.npmjs.com/package/ngraph.frombinary) [![NPM downloads](https://img.shields.io/npm/dm/ngraph.frombinary.svg?style=flat)](https://npmjs.org/package/ngraph.frombinary) [![Linux Build Status](https://img.shields.io/travis/doowb/ngraph.frombinary.svg?style=flat\u0026label=Travis)](https://travis-ci.org/doowb/ngraph.frombinary)\n\n\u003e Deserialize an ngraph.graph from binary format.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save ngraph.frombinary\n```\n\n## Usage\n\n```js\nvar load = require('ngraph.frombinary');\n```\n\n## API\n\n### [load](index.js#L30)\n\nLoad a ngraph.graph that was previously saved using [ngraph.tobinary](https://github.com/anvaka/ngraph.tobinary). This expects that the `meta.json` file created with [ngraph.tobinary](https://github.com/anvaka/ngraph.tobinary) is in the folder. See the [parse](#parse) method below when labels and links are already in memory.\n\n**Example**\n\n```js\nvar graph = load(new Graph({uniqueLinkIds: false}), {cwd: '.'});\nconsole.log(graph.getNodesCount());\n//=\u003e 4\nconsole.log(graph.getLinksCount());\n//=\u003e 3\n```\n\n**Params**\n\n* `graph` **{Object}**: [ngraph.graph](https://github.com/anvaka/ngraph.graph) instance to load the binary files into.\n* `options` **{Object}**: Options to determine where the graph is loaded from.\n* `options.cwd` **{String}**: Directory where the files are located. Defaults to `.`.\n* `options.labels` **{String}**: Name of the labels file. Defaults to `labels.json`.\n* `options.links` **{String}**: Name of the links file. Defaults to `meta.json`.\n* `options.meta` **{String}**: Name of the meta file. Defaults to `links.bin`.\n* `returns` **{Object}**: graph instance that was passed in after loading the binary files.\n\n### [parse](lib/parse.js#L26)\n\nParse function that can be used directly to parse a `links` buffer and populate a [ngraph.graph](https://github.com/anvaka/ngraph.graph) graph with nodes and links. This is useful when the labels (node names) array and the links buffer have already been loaded into memory.\n\n**Example**\n\n```js\nvar labels = ['a', 'b', 'c', 'd'];\nvar links = fs.readFileSync('links.bin');\n// links contains a binary buffer that looks like: `-1 2 3 -4 2`\nvar graph = load.parse(new Graph({uniqueLinkIds: false}), labels, links);\nconsole.log(graph.getNodesCount());\n//=\u003e 4\nconsole.log(graph.getLinksCount());\n//=\u003e 3\n```\n\n**Params**\n\n* `graph` **{Object}**: [ngraph.graph](https://github.com/anvaka/ngraph.graph) instance to load nodes and links onto.\n* `labels` **{Array}**: Array of labels used to lookup node names for the graph.\n* `links` **{Buffer}**: Binary buffer represented links to deserialize onto the graph.\n* `returns` **{Object}**: graph instance populated with nodes and links.\n\n## About\n\n### Related projects\n\n* [ngraph.graph](https://www.npmjs.com/package/ngraph.graph): Base graph structure in ngraph.* | [homepage](https://github.com/anvaka/ngraph.graph#readme \"Base graph structure in ngraph.*\")\n* [ngraph.tobinary](https://www.npmjs.com/package/ngraph.tobinary): Serialize ngraph.graph to binary format | [homepage](https://github.com/anvaka/ngraph.tobinary \"Serialize ngraph.graph to binary format\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\nPlease read the [contributing guide](contributing.md) for avice on opening issues, pull requests, and coding standards.\n\n### Building docs\n\n_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_\n\nTo generate the readme and API documentation with [verb](https://github.com/verbose/verb):\n\n```sh\n$ npm install -g verb verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm install -d \u0026\u0026 npm test\n```\n\n### Author\n\n**Brian Woodward**\n\n* [github/doowb](https://github.com/doowb)\n* [twitter/doowb](http://twitter.com/doowb)\n\n### License\n\nCopyright © 2016, [Brian Woodward](https://github.com/doowb).\nReleased under the [MIT license](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on November 05, 2016._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fngraph.frombinary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoowb%2Fngraph.frombinary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fngraph.frombinary/lists"}