crc32-stream
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -13,3 +13,3 @@ /** | ||
function CRC32Stream(options) { | ||
var CRC32Stream = module.exports = function CRC32Stream(options) { | ||
Transform.call(this, options); | ||
@@ -20,3 +20,3 @@ this.checksum = new Buffer(4); | ||
this.rawSize = 0; | ||
} | ||
}; | ||
@@ -44,4 +44,2 @@ inherits(CRC32Stream, Transform); | ||
return this.rawSize; | ||
}; | ||
module.exports = CRC32Stream; | ||
}; |
{ | ||
"name": "crc32-stream", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "a streaming CRC32 checksumer", | ||
@@ -23,3 +23,7 @@ "homepage": "https://github.com/ctalkington/node-crc32-stream", | ||
], | ||
"main": "lib/crc32-stream.js", | ||
"main": "lib/index.js", | ||
"files": [ | ||
"lib", | ||
"LICENSE-MIT" | ||
], | ||
"engines": { | ||
@@ -26,0 +30,0 @@ "node": ">= 0.8.0" |
@@ -1,2 +0,2 @@ | ||
# crc32-stream v0.2.0 [![Build Status](https://travis-ci.org/ctalkington/node-crc32-stream.svg?branch=master)](https://travis-ci.org/ctalkington/node-crc32-stream) | ||
# crc32-stream v0.3.0 [![Build Status](https://travis-ci.org/ctalkington/node-crc32-stream.svg?branch=master)](https://travis-ci.org/ctalkington/node-crc32-stream) | ||
@@ -17,2 +17,6 @@ crc32-stream is a streaming CRC32 checksumer. It uses [buffer-crc32](https://www.npmjs.org/package/buffer-crc32) behind the scenes to reliably handle binary data and fancy character sets. Data is passed through untouched. | ||
#### CRC32Stream | ||
Inherits [Transform Stream](http://nodejs.org/api/stream.html#stream_class_stream_transform) options and methods. | ||
```js | ||
@@ -36,6 +40,26 @@ var CRC32Stream = require('crc32-stream'); | ||
#### DeflateCRC32Stream | ||
Inherits [zlib.DeflateRaw](http://nodejs.org/api/zlib.html#zlib_class_zlib_deflateraw) options and methods. | ||
```js | ||
var DeflateCRC32Stream = require('crc32-stream').DeflateCRC32Stream; | ||
var source = fs.createReadStream('file.txt'); | ||
var checksum = new DeflateCRC32Stream(); | ||
checksum.on('end', function(err) { | ||
// do something with checksum.digest() here | ||
}); | ||
// either pipe it | ||
source.pipe(checksum); | ||
// or write it | ||
checksum.write('string'); | ||
checksum.end(); | ||
``` | ||
### Instance API | ||
Inherits [Transform Stream](http://nodejs.org/api/stream.html#stream_class_stream_transform) methods. | ||
#### digest() | ||
@@ -49,10 +73,8 @@ | ||
#### size() | ||
#### size(compressed) | ||
Returns the raw size/length of passed-through data. | ||
### Instance Options | ||
If `compressed` is `true`, it returns compressed length instead. (DeflateCRC32Stream) | ||
Inherits [Transform Stream](http://nodejs.org/api/stream.html#stream_class_stream_transform) options. | ||
## Things of Interest | ||
@@ -59,0 +81,0 @@ |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
81
0
7331
6
86