Comparing version 1.1.0 to 1.2.0
# 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 |
@@ -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 @@ |
{ | ||
"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}]:` ) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
31040
692
217
0