Socket
Socket
Sign inDemoInstall

hyperdrive

Package Overview
Dependencies
Maintainers
1
Versions
271
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperdrive - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

28

index.js

@@ -87,2 +87,30 @@ var constants = require('constants')

Archive.prototype.download = function (i, cb) {
if (!cb) cb = noop
var ptr = 0
var self = this
if (typeof i === 'number') this.entry(i, onentry)
else onentry(null, i)
function onentry (err, entry) {
if (err) return cb(err)
var feed = self._getFeed(entry)
feed.on('put', kick)
kick()
function kick () {
if (!feed.blocks) return
for (; ptr < feed.blocks; ptr++) {
if (!feed.has(ptr)) return
}
feed.removeListener('put', kick)
cb(null)
}
}
}
Archive.prototype.select = function (i, cb) {

@@ -89,0 +117,0 @@ if (!cb) cb = noop

2

package.json
{
"name": "hyperdrive",
"version": "2.0.0",
"version": "2.1.0",
"description": "A file sharing network based on rabin file chunking and append only feeds of data verified by merkle trees.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -136,10 +136,7 @@ # hyperdrive

#### `archive.select(index)`
#### `archive.download(index, [callback])`
Select a file to be downloaded
Downloads the file specified by index and calls the callback when done.
You have to call this or create a file stream to download a file.
#### `archive.delect(index)`
Deselects a file.
#### `var rs = archive.createFileStream(index)`

@@ -146,0 +143,0 @@

@@ -22,3 +22,3 @@ var tape = require('tape')

clone.once('file-downloaded', function () {
clone.download(0, function () {
var buf = []

@@ -36,4 +36,2 @@ clone.createFileStream(0)

clone.select(0)
var p1 = drive.createPeerStream()

@@ -40,0 +38,0 @@ var p2 = driveClone.createPeerStream()

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc