holepunchto / hyperdrive

Hyperdrive is a secure, real time distributed file system
Apache License 2.0
1.86k stars 134 forks source link

storage is not a function #200

Closed ilyaigpetrov closed 6 years ago

ilyaigpetrov commented 6 years ago

Task: create an archive and write it to file.

'use strict';
const fs = require('fs');
const Hyperdrive = require('hyperdrive');
const archive = Hyperdrive('./'); // SIC!

archive.writeFile('/hello.md', '# Hello _Markdown_!', (err) => {
  if (err) throw err;
  const outFile = fs.createWriteStream('out-archive.txt');
  (archive.replicate()).pipe(outFile);
});

Result:

/mnt/d/__Storage__/Workspace/repos/hyperarchives/node_modules/hyperdrive/index.js:891
      return storage(path.join(folder, 'metadata', name))
             ^

TypeError: storage is not a function