hypercore-upload-server
File ingestion with Hypercore over WebSockets
Installation
$ npm install hypercore-upload-server
Example
Server
Client
Usage
const Server = const path = const raf = const dataDir = '/path/to/data/dir' const server = // storage for Corestore and it's Hypercore instances { return } // write uploaded chunks somewhere, like S3, the filesystem, or a Hyperdrive { const filename = path }
API
server = new Server(opts)
Create a new Server
for hypercore uploads over websockets where opts
can be:
corestore: null // a corestore for a hypercore/hypertrie factory storage: null // an optional random access storage factory for a `Corestore` instance { ... } // called when data for a key at an offset needs to be written gc: timeout: 5 * 1000 // timeout in milliseconds before a worker thread GC's any resources
See example/server.js
for a complete example.
server.listen(port[, host[, callback]])
Listen on a given port
an optional host
calling callback(err)
upon
error or success.
License
MIT