Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dat-alias-storage

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dat-alias-storage

A storage provider for dat that enables aliased file structures.

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

dat-alias-storage

Build Status

This is a fork of dat-storage which adds random-access-alias to allow dats to be made with content.data aliased to files outside of the specified dat directory.

This 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.

Installation

npm install --save dat-alias-storage

Usage

const storage = require("dat-alias-storage");
const hyperdrive = require("hyperdrive");

async function resolver(name) {
  if (name === "a.txt") {
    return "/var/web/http/collection/some.txt";
  }
  return name;
}

// Files are stored at whatever paths are returned from the resolver
// Metadata (hashes and stuff) are stored in ./my-dataset/.dat
// Secret keys are stored in ~/.dat/secret_keys/<discovery-key>
const archive = hyperdrive(storage("my-dataset", resolver));

API

var store = storage(dir: string, resolver: (string) => string | Promise<string>, opts?: object)

Takes Arguments:

  • dir: location where to store the primary dat metadata
  • 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.
  • opts: optionally accepts the same options as dat-storage.

Returns a storage provider for creating a hyperdrive.

FAQs

Package last updated on 23 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc