{"id":19837405,"url":"https://github.com/e-e-e/dat-alias-storage","last_synced_at":"2025-06-10T20:11:39.414Z","repository":{"id":43545307,"uuid":"223264005","full_name":"e-e-e/dat-alias-storage","owner":"e-e-e","description":"A storage provider for dat that enables aliased file structures.","archived":false,"fork":false,"pushed_at":"2023-01-05T01:31:44.000Z","size":1472,"stargazers_count":0,"open_issues_count":16,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T22:12:19.069Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/e-e-e.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-21T20:55:59.000Z","updated_at":"2019-11-23T10:56:25.000Z","dependencies_parsed_at":"2023-02-03T04:01:40.944Z","dependency_job_id":null,"html_url":"https://github.com/e-e-e/dat-alias-storage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fdat-alias-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fdat-alias-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fdat-alias-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fdat-alias-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/e-e-e","download_url":"https://codeload.github.com/e-e-e/dat-alias-storage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fdat-alias-storage/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259144808,"owners_count":22811926,"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-11-12T12:14:20.857Z","updated_at":"2025-06-10T20:11:39.370Z","avatar_url":"https://github.com/e-e-e.png","language":"JavaScript","readme":"# dat-alias-storage\n\n[![Build Status](https://travis-ci.org/e-e-e/dat-alias-storage.svg?branch=master)](https://travis-ci.org/e-e-e/dat-alias-storage)\n\nThis is a fork of [dat-storage](https://github.com/datproject/dat-storage) which adds [random-access-alias](https://github.com/e-e-e/random-access-alias) to allow dats to be made with `content.data` aliased to files outside of the specified dat directory.\n\nThis is useful if you have a large data set which you would like to provide as a collection of smaller dats, without duplicating data or having to change file structure. One such use case, is a large library of texts, with sets of texts defined as collections, **dat-alias-storage** can be used to share the collections as individual dats.\n\n## Installation\n\n```bash\nnpm install --save dat-alias-storage\n```\n\n## Usage\n\n```js\nconst storage = require(\"dat-alias-storage\");\nconst hyperdrive = require(\"hyperdrive\");\n\nasync function resolver(name) {\n  if (name === \"a.txt\") {\n    return \"/var/web/http/collection/some.txt\";\n  }\n  return name;\n}\n\n// Files are stored at whatever paths are returned from the resolver\n// Metadata (hashes and stuff) are stored in ./my-dataset/.dat\n// Secret keys are stored in ~/.dat/secret_keys/\u003cdiscovery-key\u003e\nconst archive = hyperdrive(storage(\"my-dataset\", resolver));\n```\n\n## API\n\n#### `var store = storage(dir: string, resolver: (string) =\u003e string | Promise\u003cstring\u003e, opts?: object)`\n\nTakes Arguments:\n\n- `dir`: location where to store the primary dat metadata\n- `resolver`: a function which takes a string and returns a string or a promise resolving to a string. Used to map desired dat file structure to real file locations on disk.\n- `opts`: optionally accepts the same options as [dat-storage](https://github.com/datproject/dat-storage).\n\nReturns a storage provider for creating a [hyperdrive](https://github.com/mafintosh/hyperdrive).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe-e-e%2Fdat-alias-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fe-e-e%2Fdat-alias-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe-e-e%2Fdat-alias-storage/lists"}