hypercore-indexed-file

0.1.3 • Public • Published

hypercore-indexed-file

Address a local file or HTTP resource as an indexed Hypercore feed.

Installation

$ npm install hypercore-indexed-file

Usage

const feed = file(pathspec, (err) => {
  // file at `pathspec` has been indexed
  // bitfield, tree, and signatures generated
})

API

feed = file(pathspec[, opts[, callback]])

Creates a Hypercore feed with indexing set to true that uses random-access-storage-from to derive the data storage for the created feed from the given pathspec string. When the feed is ready, it will index the file specified at pathspec by streaming the chunks through the feed, generating the bitfield, merkle tree, and signatures.

const feed = file('https://example.com/example.txt', (err) => {
  feed.createReadStream().pipe(process.stdout)
  feed.audit(console.log) // should show `0` invalid nodes
})

License

MIT

Package Sidebar

Install

npm i hypercore-indexed-file

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

7.36 kB

Total Files

6

Last publish

Collaborators

  • werle