Socket
Socket
Sign inDemoInstall

hypercore-streams

Package Overview
Dependencies
6
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

4

index.js

@@ -44,3 +44,3 @@ const { Writable, Readable } = require('streamx')

this.index = this.start
this.options = { wait: opts.wait !== false, ifAvailable: !!opts.ifAvailable }
this.options = { wait: opts.wait !== false, ifAvailable: !!opts.ifAvailable, valueEncoding: opts.valueEncoding }
}

@@ -56,3 +56,3 @@

}
if (this.tail) this.start = this.length
if (this.tail) this.start = this.feed.length
this.index = this.start

@@ -59,0 +59,0 @@ cb(null)

{
"name": "hypercore-streams",
"version": "1.0.0",
"version": "1.0.1",
"description": "External implementation of a WriteStream and ReadStream for Hypercore",

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

@@ -17,3 +17,4 @@ # hypercore-streams

start: 0,
live: true
live: true,
valueEncoding: 'json'
})

@@ -20,0 +21,0 @@ ```

@@ -22,2 +22,24 @@ const tape = require('tape')

tape('tail reading stream', function (t) {
const feed = hypercore(ram)
t.plan(2)
feed.append(['a', 'b', 'c'], function () {
const rs = new ReadStream(feed, { tail: true, live: true })
const expected = ['d', 'e']
rs.on('data', function (data) {
t.same(data, Buffer.from(expected.shift()))
})
feed.ready(function () {
feed.append(['d', 'e'])
})
rs.on('end', function () {
t.fail('should not end')
})
})
})
tape('live readstream', function (t) {

@@ -73,1 +95,17 @@ t.plan(2)

})
tape('valueEncoding test', function (t) {
const feed = hypercore(ram, { valueEncoding: 'json' })
feed.append(['a', 'b', 'c'], function () {
const rs = new ReadStream(feed, { valueEncoding: 'buffer' })
const expected = ['a', 'b', 'c']
rs.on('data', function (data) {
t.same(data, Buffer.from('"' + expected.shift() + '"\n'))
})
rs.on('end', function () {
t.end()
})
})
})
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc