{"id":13541100,"url":"https://github.com/poga/hyperdrive-ln","last_synced_at":"2025-11-10T10:04:20.677Z","repository":{"id":57270191,"uuid":"76414599","full_name":"poga/hyperdrive-ln","owner":"poga","description":"create symbolic link between hyperdrives","archived":false,"fork":false,"pushed_at":"2017-02-19T23:53:25.000Z","size":34,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-04T05:22:11.366Z","etag":null,"topics":["hyperdrive","symlink"],"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/poga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-14T01:50:23.000Z","updated_at":"2021-01-13T19:51:45.000Z","dependencies_parsed_at":"2022-08-25T02:51:38.411Z","dependency_job_id":null,"html_url":"https://github.com/poga/hyperdrive-ln","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/poga/hyperdrive-ln","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poga%2Fhyperdrive-ln","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poga%2Fhyperdrive-ln/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poga%2Fhyperdrive-ln/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poga%2Fhyperdrive-ln/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poga","download_url":"https://codeload.github.com/poga/hyperdrive-ln/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poga%2Fhyperdrive-ln/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263785393,"owners_count":23511100,"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":["hyperdrive","symlink"],"created_at":"2024-08-01T10:00:38.499Z","updated_at":"2025-11-10T10:04:20.570Z","avatar_url":"https://github.com/poga.png","language":"JavaScript","readme":"# hyperdrive-ln\n\n[![NPM Version](https://img.shields.io/npm/v/hyperdrive-ln.svg)](https://www.npmjs.com/package/hyperfeed) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n\ncreate symbolic link between [hyperdrives](https://github.com/mafintosh/hyperdrive)\n\n`npm i hyperdrive-ln`\n\n## Usage\n\n```js\nconst ln = require('hyperdrive-ln')\n\nvar drive = hyperdrive(memdb())\nvar archive = drive.createArchive()\n\nln.link(archive, 'linkfile', \u003cARCHIVE KEY\u003e, [meta], err =\u003e {}) // create symlink to another archive\nln.readlink(archive, 'linkfile', (err, link) =\u003e {}) // get link data\n\n// assume ln.link(archive, 'path/to/file', \u003cARCHIVE KEY\u003e)\nln.resolve(archive, 'path/to/file/within/linked/archive', (err, link, restOfThePath)) // returns (err, {link: \u003cARCHIVE_KEY\u003e, meta: {...}}, 'within/linked/archive')\n\n// resolve through archives\nln.deepResolve(drive, swarmer, archive, path, (err, result) =\u003e {})\n\nln.encode(key, [meta]) // encode a key for linkfile\nln.decode(data) // decode a linkfile content to key\n```\n\n## API\n\n#### `ln.link(archive, path, archiveKey, [meta], cb)`\n\nCreate a symlink at `path` point to `archiveKey`.\n\nYou can pass a `meta` object to store it in the symlink.\n\n#### `ln.readlink(archive, path, cb)`\n\nGet the link data stored inside a symlink.\n\n#### `ln.resolve(archive, path, cb)`\n\nResolve a path. Returns an archive and a path within that archive with `cb(err, linkedArchiveKey, pathWithinLinkedArchive)`\n\n* If there's a symlink encountered in the path. `cb(err, link, pathWithinLinkedArchive)` will be invoked.\n* If there's no symlink in the path, `cb(err, {}, path)` will be called.\n\nfor example:\n\n```js\nln.link(archive, 'foo/bar', '\u003cLINK_KEY\u003e', (err) =\u003e {\n    ln.resolve(archive, 'foo/bar/baz', (err, link, path) =\u003e {\n      // link === {link: '\u003cLINK_KEY\u003e', meta: {...}}\n      // path === 'baz'\n    })\n})\n```\n\n#### `ln.deepResolve(drive, swarmer, archive, path, cb)`\n\nRecursively resolve a path through archives. Create swarm connection when necessary.\n\n`swarmer` is anything let you join swarm . For example: [hyperdiscovery](https://github.com/karissa/hyperdiscovery).\n\ncallback `cb(err, result)` where `result` is a recursive structure:\n```js\n{\n  archive: // traversed archive,\n  path: // consumed path,\n  swarm: // swarm instance,\n  next: result // next component if there's one\n}\n```\n\nFor example: Assume we have an `archive1` which `/foo/bar` linked to `archive2`.\n\n```js\nln.deepResolve(drive, swarmer, archive1, '/foo/bar/baz/baz.txt', cb)\n```\n\nwill get the result:\n\n```js\n{\n  archive: archive1,\n  path: '/foo/bar',\n  swarm: // a swarm instance,\n  next: {\n    archive: archive2,\n    path: 'baz/baz.txt',\n    swarm: // another swarm instance\n  }\n}\n```\nuse `deepClose(result)` to close all swarm instance in the result.\n\n#### `ln.deepClose(result)`\n\nClose all swarm instance in the result.\n\n#### `body = ln.encode(key, [meta])`\n\nEncode a key to symlink file body.\n\n#### `ln.decode(body)`\n\nDecode a symlink file body to linked archive key.\n\n## License\n\nThe MIT License\n","funding_links":[],"categories":["Outdated"],"sub_categories":["Other Related Dat Project Modules"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoga%2Fhyperdrive-ln","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoga%2Fhyperdrive-ln","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoga%2Fhyperdrive-ln/lists"}