Huge News!Announcing our $40M Series B led by Abstract Ventures.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 1.1.0 to 1.2.0

10

CHANGELOG.md
# Changelog
## 1.2.0
- **fix(filter-stream):** Prevent emitting too small blocks
## 1.1.0
- **fix(read-stream):** Throw if [start,end] are OOB
- **feat(blockmap):** Add .createFilterStream()
- **feat(readstream):** Add `fd` option

15

lib/filter-stream.js

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

this.options.readableObjectMode = true
this.options.verify = this.options.verify != null ?

@@ -180,3 +181,3 @@ !!this.options.verify : true

while( offset < buffer.length ) {
while( buffer.length - offset >= this.blockSize ) {
this._pushBlock( buffer.slice( offset, offset + this.blockSize ) )

@@ -195,2 +196,14 @@ offset = offset + this.blockSize

_flush( done ) {
var buffer = Buffer.concat( this._buffers )
var block = Buffer.alloc( this.blockSize )
buffer.copy( block )
this._pushBlock( block )
done()
},
}

@@ -197,0 +210,0 @@

2

package.json
{
"name": "blockmap",
"version": "1.1.0",
"version": "1.2.0",
"description": "Tizen's block map format",

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

@@ -50,3 +50,5 @@ # Blockmap

end: 5
}, {
},
// More ranges omitted for brevity
{
checksum: 'cb732fc3f3a0f81f6a761a534201c05549c8efe4a92630ccd24241f72d7d618c',

@@ -82,2 +84,3 @@ start: 198,

<Range chksum="e8a26f49a71262870f8294a73f40f122d622fd70fb82bef01c0322785e9fd6b2">3-5</Range>
<!-- More ranges omitted for brevity -->
<Range chksum="cb732fc3f3a0f81f6a761a534201c05549c8efe4a92630ccd24241f72d7d618c">198-199</Range>

@@ -104,3 +107,3 @@ </BlockMap>

// Disable range checksum verification:
var readStream = new BlockMap.ReadStream( '/path/to/resin-os.img', blockMap, {
var blockReadStream = new BlockMap.ReadStream( '/path/to/resin-os.img', blockMap, {
verify: false,

@@ -120,3 +123,3 @@ })

var blockMap = BlockMap.parse( fs.readFileSync( '/path/to/resin-os.bmap' ) )
var readStream = new BlockMap.ReadStream( '/path/to/resin-os.img', blockMap )
var blockReadStream = new BlockMap.ReadStream( '/path/to/resin-os.img', blockMap )

@@ -127,3 +130,3 @@ // The buffer will have two additional properties set;

// Which can then be used to write only those blocks to the target:
readStream.on( 'readable', function() {
blockReadStream.on( 'readable', function() {
var buffer = null

@@ -135,6 +138,6 @@ while( buffer = this.read() ) {

readStream.once( 'end', function() {
console.log( 'Read', readStream.blocksRead, 'mapped blocks' )
console.log( 'Read', readStream.bytesRead, 'mapped bytes' )
console.log( 'Read', readStream.rangesRead, 'mapped ranges' )
blockReadStream.once( 'end', function() {
console.log( 'Read', blockReadStream.blocksRead, 'mapped blocks' )
console.log( 'Read', blockReadStream.bytesRead, 'mapped bytes' )
console.log( 'Read', blockReadStream.rangesRead, 'mapped ranges' )
})

@@ -210,5 +213,5 @@ ```

```js
var readStream = new BlockMap.ReadStream( '/path/to/resin-os.img', blockMap )
var blockReadStream = new BlockMap.ReadStream( '/path/to/resin-os.img', blockMap )
readStream.on( 'error', function( error ) {
blockReadStream.on( 'error', function( error ) {
if( error.checksum ) {

@@ -215,0 +218,0 @@ console.log( `Checksum mismatch for range [${error.range.start},${error.range.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