This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

dat-storage

1.1.2 • Public • Published

deprecated

More info on active projects and modules at dat-ecosystem.org


dat-storage

Dat specific storage provider for Hyperdrive

npm install dat-storage

Usage

var storage = require('dat-storage')

// files are stored in ./my-dataset
// metadata (hashes and stuff) are stored in ./my-dataset/.dat
// secret keys are stored in ~/.dat/secret_keys/<discovery-key>
var archive = hyperdrive(storage('my-dataset'))

Custom storage provider

You can require this module in your own storage provider in order to override certain behaviors for some files while still using the default dat storage methods for other files. Here's an example of overriding only the secret key storage and nothing else:

const defaultStorage = require('dat-storage')
const alternativeSecretStorage = require('your-own-custom-random-access-file-module')

module.exports = function keychainStorage() {
  const storage = defaultStorage(...arguments)
  return {
    metadata: function(file, opts) {
      if (file === 'secret_key') alternativeSecretStorage(file)
      return storage.metadata(...arguments)
    },
    content: function(file, opts) {
      return storage.content(...arguments)
    }
  }
}

Options

  • secretDir - folder to store secret keys in (default is users home dir)
  • prefix - subfolder to put dat SLEEP files in (default is .dat/)

Secret Keys

By default secret keys are stored in the users home directory via dat-secret-storage. To change the directory, pass it as an option:

var storage = require('dat-storage')

var archive = hyperdrive(storage('my-dataset', {secretDir: '/secret_keys'})

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i dat-storage

Weekly Downloads

96

Version

1.1.2

License

MIT

Unpacked Size

8.37 kB

Total Files

5

Last publish

Collaborators

  • cblgh
  • frando
  • jhand
  • juliangruber
  • leichtgewicht
  • mafintosh
  • ninabreznik
  • pfrazee
  • rangermauve
  • serapath
  • the-real-dk
  • zootella