little-core-labs / hypercore-indexed-file

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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

License:MIT License


Languages

Language:JavaScript 100.0%