Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hash-base

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hash-base - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

55

index.js

@@ -18,3 +18,27 @@ 'use strict'

HashBase.prototype._transform = function (chunk, encoding, callback) {
var error = null
try {
if (encoding !== 'buffer') chunk = new Buffer(chunk, encoding)
this.update(chunk)
} catch (err) {
error = err
}
callback(error)
}
HashBase.prototype._flush = function (callback) {
var error = null
try {
this.push(this._digest())
} catch (err) {
error = err
}
callback(error)
}
HashBase.prototype.update = function (data, encoding) {
if (!Buffer.isBuffer(data) && typeof data !== 'string') throw new TypeError('Data must be a string or a buffer')
if (this._finalized) throw new Error('Digest already called')

@@ -43,2 +67,6 @@ if (!Buffer.isBuffer(data)) data = new Buffer(data, encoding || 'binary')

HashBase.prototype._update = function (data) {
throw new Error('_update is not implemented')
}
HashBase.prototype.digest = function (encoding) {

@@ -53,6 +81,2 @@ if (this._finalized) throw new Error('Digest already called')

HashBase.prototype._update = function (data) {
throw new Error('_update is not implemented')
}
HashBase.prototype._digest = function () {

@@ -62,25 +86,2 @@ throw new Error('_digest is not implemented')

HashBase.prototype._transform = function (chunk, encoding, callback) {
var error = null
try {
if (encoding !== 'buffer') chunk = new Buffer(chunk, encoding)
this.update(chunk)
} catch (err) {
error = err
}
callback(error)
}
HashBase.prototype._flush = function (callback) {
var error = null
try {
this.push(this._digest())
} catch (err) {
error = err
}
callback(error)
}
module.exports = HashBase
{
"name": "hash-base",
"version": "2.0.1",
"version": "2.0.2",
"description": "abstract base class for hash-streams",

@@ -5,0 +5,0 @@ "keywords": [

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