Skip to content

Commit

Permalink
Modernize.
Browse files Browse the repository at this point in the history
Updated dependencies.
Fixed lint errors.
Dropped node 4 support.
  • Loading branch information
ceejbot committed Jun 10, 2018
1 parent b8f82ab commit 5489824
Show file tree
Hide file tree
Showing 8 changed files with 6,752 additions and 29 deletions.
1 change: 0 additions & 1 deletion .travis.yml
@@ -1,7 +1,6 @@
sudo: false
language: node_js
node_js:
- "4"
- "6"
- "8"
- "10"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -23,7 +23,7 @@ If you don't specify an algorithm, the 64-bit single-core `B` algorithm is used.
var Avon = require('avon');
var assert = require('assert');

var buf = new Buffer('this is some input');
var buf = Buffer.from('this is some input');

var hash = Avon.sumBuffer(buf, Avon.ALGORITHMS.BP);
assert(hash instanceof Buffer);
Expand Down
12 changes: 6 additions & 6 deletions index.js
@@ -1,10 +1,10 @@
var
const
bindings = require('bindings'),
blake2 = bindings('blake2'),
P = require('p-promise')
;

var B = 0,
const B = 0,
BP = 1,
S = 2,
SP = 3;
Expand All @@ -16,7 +16,7 @@ function wrapperFile(algo, fname)

var deferred = P.defer();

blake2.b2_file(algo, fname, function(err, result)
blake2.b2_file(algo, fname, (err, result) =>
{
if (err) deferred.reject(err);
else deferred.resolve(result);
Expand All @@ -32,7 +32,7 @@ function sumBuffer(buffer, algorithm)

if (!Buffer.isBuffer(buffer))
{
throw new Error('You must pass a buffer as input.');
throw new TypeError('You must pass a buffer as input.');
}

return blake2.b2_buffer(algorithm, buffer);
Expand All @@ -51,8 +51,8 @@ function sumFile(fname, algorithm, callback)
module.exports =
{
// convenience wrappers
sumBuffer: sumBuffer,
sumFile: sumFile,
sumBuffer,
sumFile,
sumStream: require('./streaming'),
ALGORITHMS: require('./streaming').ALGORITHMS,

Expand Down

0 comments on commit 5489824

Please sign in to comment.