Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hypercore-byte-stream

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hypercore-byte-stream - npm Package Compare versions

Comparing version 1.0.10 to 1.0.11

8

index.js

@@ -22,2 +22,3 @@ const assert = require('assert')

this._downloaded = false
this._ifAvailable = false

@@ -29,3 +30,3 @@ if (opts.feed) {

start ({ feed, blockOffset, blockLength, byteOffset, byteLength } = {}) {
start ({ feed, blockOffset, blockLength, byteOffset, byteLength, ifAvailable } = {}) {
assert(!this.feed, 'Can only provide options once (in the constructor, or asynchronously).')

@@ -40,2 +41,3 @@ assert(feed, 'Must provide a feed')

this.feed = feed
this._ifAvailable = ifAvailable
this._range = {

@@ -55,3 +57,3 @@ start: blockOffset || 0,

// end + 1 so we can support seeks to the end of the file
this.feed.seek(offset, { start: this._range.start, end: this._range.end + 1 }, cb)
this.feed.seek(offset, { start: this._range.start, end: this._range.end + 1, ifAvailable: this._ifAvailable }, cb)
}

@@ -164,3 +166,3 @@

this.feed.get(this._range.start++, { wait: !this._downloaded }, (err, data) => {
this.feed.get(this._range.start++, { ifAvailable: this._ifAvailable, wait: !this._downloaded }, (err, data) => {
if (err || this.destroyed) return this.destroy(err)

@@ -167,0 +169,0 @@ if (this._offset) data = data.slice(this._offset)

{
"name": "hypercore-byte-stream",
"version": "1.0.10",
"version": "1.0.11",
"description": "A Readable stream wrapper around Hypercore that supports reading byte ranges.",

@@ -27,3 +27,3 @@ "main": "index.js",

"random-access-memory": "^3.1.1",
"tape": "^4.9.2"
"tape": "^5.0.1"
},

@@ -30,0 +30,0 @@ "dependencies": {

@@ -167,3 +167,4 @@ const test = require('tape')

byteOffset: 500,
byteLength: 700
byteLength: 700,
ifAvailable: false
})

@@ -321,4 +322,8 @@

t.false(stream._range)
if (output._selections) t.same(output._selections.length, expectedSelections)
else t.pass()
if (output._selections) {
t.same(output._selections.length, expectedSelections)
} else {
console.log('PASSING')
t.pass()
}
})

@@ -325,0 +330,0 @@ })

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