Socket
Socket
Sign inDemoInstall

pull-write

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pull-write - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

46

index.js

@@ -7,2 +7,4 @@ //another idea: buffer 2* the max, but only call write with half of that,

var Looper = require('looper')
function append (array, item) {

@@ -19,16 +21,26 @@ (array = array || []).push(item)

_read = read
if(ended) return read(ended, function (err) {
cb(err)
_cb && _cb()
})
if(ended)
return read(ended, function (err) {
cb(err); _cb && _cb()
})
var reading = false
function more () {
if(reading || ended) return
reading = true
read(null, function (err, data) {
reading = false
next(err, data)
var more = Looper(function () {
if(reading || ended) return
reading = true
read(null, function (err, data) {
reading = false
;(function (end, data) {
if(ended) return
ended = end
if(!ended) {
queue = reduce(queue, data)
length = (queue && queue.length) || 0
if(queue != null) flush()
if(length < max) more()
}
else if(!writing) cb(ended === true ? null : ended)
})(err, data)
})
})
}

@@ -53,14 +65,2 @@ function flush () {

function next (end, data) {
if(ended) return
ended = end
if(!ended) {
queue = reduce(queue, data)
length = (queue && queue.length) || 0
if(queue != null) flush()
if(length < max) more()
}
else if(!writing) cb(ended === true ? null : ended)
}
reader.abort = function (__cb) {

@@ -67,0 +67,0 @@ _cb = function (end) {

{
"name": "pull-write",
"description": "",
"version": "1.1.1",
"version": "1.1.2",
"homepage": "https://github.com/dominictarr/pull-write",

@@ -11,2 +11,3 @@ "repository": {

"dependencies": {
"looper": "^4.0.0",
"pull-cat": "^1.1.11",

@@ -13,0 +14,0 @@ "pull-stream": "^3.4.5"

@@ -193,2 +193,18 @@ var tape = require('tape')

tape('range error', function (t) {
var len = 0
pull(
pull.count(10000),
createWrite(function (data, cb) {
len += data.length
cb()
}, function (a, b) {
if(!a) return [b]
return a.concat(b)
}, 100, function (err) {
t.equal(len, 10001)
t.end()
})
)
})
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