New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

blockmap

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blockmap - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

4

CHANGELOG.md

@@ -7,2 +7,6 @@ # Change Log

## v3.4.0 - 2018-05-30
* Feat(read-stream): Add a generateChecksums option #51 [Alexis Svinartchouk]
## v3.3.0 - 2018-05-30

@@ -9,0 +13,0 @@

23

lib/read-stream.js

@@ -19,2 +19,3 @@ var stream = require( 'stream' )

* @param {Boolean} [options.verify=true] - verify range checksums
* @param {Boolean} [options.generateChecksums=false] - calculate range checksums and update blockmap
* @param {Boolean} [options.autoClose=true] - close the fd on end

@@ -60,2 +61,10 @@ * @param {Number} [options.start] - byte offset in file to read from

!!options.verify : true
/** @type {Boolean} Whether or not to calculate range checksums and update blockmap */
this.generateChecksums = options.generateChecksums != null ?
!!options.generateChecksums : false
if (this.verify && this.generateChecksums) {
throw new Error( 'verify and generateChecksums options are mutually exclusive' )
}
/** @type {BlockMap.Range} Range being currently processed */

@@ -98,3 +107,3 @@ this.currentRange = null

*/
this._hash = this.verify ?
this._hash = ( this.verify || this.generateChecksums ) ?
crypto.createHash( this.blockMap.checksumType ) : null

@@ -152,3 +161,3 @@

var needsVerify = this.verify &&
var needsVerify = ( this.verify || this.generateChecksums ) &&
this.currentRange != null &&

@@ -168,3 +177,3 @@ this.currentRange.offset === this.currentRange.length

if( range.checksum !== digest ) {
if( this.verify && ( range.checksum !== digest ) ) {
error = new Error( `Invalid checksum for range [${range.startLBA},${range.endLBA}], bytes ${range.start}-${range.end}` )

@@ -176,3 +185,7 @@ error.checksum = digest

this.rangesVerified++
if( this.generateChecksums ) {
range.range.checksum = digest
} else {
this.rangesVerified++
}

@@ -220,3 +233,3 @@ },

// Feed the hash if we're verifying
if( this.verify ) {
if( this.verify || this.generateChecksums ) {
this._hash.update( chunk.buffer )

@@ -223,0 +236,0 @@ }

{
"name": "blockmap",
"version": "3.3.0",
"version": "3.4.0",
"description": "Tizen's block map format",

@@ -5,0 +5,0 @@ "license": "MIT",

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