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

block-stream2

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

block-stream2 - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

25

index.js

@@ -28,6 +28,25 @@ const { Transform } = require('readable-stream')

while (this._bufferedBytes >= this.size) {
const b = Buffer.concat(this._buffered)
this._bufferedBytes -= this.size
this.push(b.slice(0, this.size))
this._buffered = [ b.slice(this.size, b.length) ]
// Assemble the buffers that will compose the final block
const blockBufs = []
let blockBufsBytes = 0
while (blockBufsBytes < this.size) {
const b = this._buffered.shift()
if (blockBufsBytes + b.length <= this.size) {
blockBufs.push(b)
blockBufsBytes += b.length
} else {
// If the last buffer is larger than needed for the block, just
// use the needed part
const neededSize = this.size - blockBufsBytes
blockBufs.push(b.slice(0, neededSize))
blockBufsBytes += neededSize
this._buffered.unshift(b.slice(neededSize))
}
}
// Then concat just those buffers, leaving the rest untouched in _buffered
this.push(Buffer.concat(blockBufs, this.size))
}

@@ -34,0 +53,0 @@ next()

5

package.json
{
"name": "block-stream2",
"version": "2.0.0",
"version": "2.1.0",
"description": "transform input into equally-sized blocks of output",

@@ -10,6 +10,7 @@ "main": "index.js",

"devDependencies": {
"standard": "^16.0.3",
"tape": "^4.2.2"
},
"scripts": {
"test": "tape test/*.js"
"test": "standard && tape test/*.js"
},

@@ -16,0 +17,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

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