Comparing version 0.2.0 to 0.2.1
@@ -1,4 +0,3 @@ | ||
#! /usr/bin/env node | ||
;(function () { | ||
'use strict'; | ||
var fs = require('fs'); | ||
@@ -20,4 +19,9 @@ var crc32c = require('./crc32c.node'); | ||
s.on('data', function (data) { result = crc32c.compute(data); }); | ||
s.on('end', function () { console.log(result); }); | ||
})(); | ||
var dataChunks = []; | ||
s.on('data', function (data) { dataChunks.push(data) }); | ||
s.on('end', function () { | ||
console.log(crc32c.compute(Buffer.concat(dataChunks))); | ||
}); | ||
})(); /* end of anonymous function */ |
{ | ||
"name": "crc32c", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "CRC32C C implementation for Linux.", | ||
@@ -14,3 +14,3 @@ "keywords": ["crc", "crc32", "crc32c", "hash", "castagnoli" ], | ||
}, | ||
"bin": { "crc32c": "./crc32c.js" }, | ||
"bin": { "crc32c": "./crc32c" }, | ||
"files": [ | ||
@@ -17,0 +17,0 @@ "LICENSE", |
@@ -12,3 +12,3 @@ Node-crc32c | ||
or | ||
or | ||
@@ -23,5 +23,8 @@ npm install crc32c | ||
// Works with strings! | ||
var toHash = "HELLOWORLD"; | ||
console.log(crc32c.compute(toHash)); | ||
console.log(crc32c.compute(toHash)); | ||
// Or buffers! | ||
console.log(crc32c.compute(new Buffer('{"jsonString":"property1","jsonArray":["arr1","arr2","arr3"]}'))); | ||
``` | ||
@@ -28,0 +31,0 @@ |
var crc32c = require('../bin/crc32c'); | ||
console.log(crc32c.compute('hello\n')); | ||
console.log(crc32c.compute(new Buffer('hello\n'))); | ||
console.log(crc32c.compute('{"jsonString":"property1","jsonArray":["arr1","arr2","arr3"]}')); | ||
console.log(crc32c.compute(new Buffer('{"jsonString":"property1","jsonArray":["arr1","arr2","arr3"]}'))); | ||
console.log(crc32c.compute('{"jsonString":"property1","jsonArray":["arr1","arr2","arr3"]}')); |
Sorry, the diff of this file is not supported yet
7136
22
39
9