Socket
Socket
Sign inDemoInstall

multiblob

Package Overview
Dependencies
Maintainers
19
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multiblob - npm Package Compare versions

Comparing version 1.13.1 to 1.13.2

.github/stale.yml

31

index.js

@@ -16,2 +16,3 @@ var cont = require('cont')

var Read = require('pull-file')
var Catch = require('pull-catch')

@@ -25,6 +26,26 @@ var u = require('./util')

function read (filename) {
return ReadFile(filename)
}
/**
* Wraps the `pull-file` function module with two changes: errors are redacted,
* and any error except ENOENT (file not found) will be logged to the server.
*
* @param {...object} args - arguments to pass to `pull-file`
*
* @return {function} pull-stream source, to be consumed by a through or sink
*/
function readFile (...args) {
return pull(
Read(...args),
Catch(err => {
if (err.code !== 'ENOENT') {
console.error(err.toString())
}
err.message = 'could not get blob'
return false // pass along error
})
)
};
function toArray (h) {

@@ -197,3 +218,3 @@ return Array.isArray(h) ? h : [h]

else
stream.resolve(Read(toPath(dir, opts.hash), {
stream.resolve(readFile(toPath(dir, opts.hash), {
start: opts.start,

@@ -212,3 +233,3 @@ end: opts.end

if(isEmptyHash(hash)) return pull.empty()
return Read(toPath(dir, opts))
return readFile(toPath(dir, opts))
}

@@ -215,0 +236,0 @@ var hash = opts.key || opts.hash

3

package.json
{
"name": "multiblob",
"description": "",
"version": "1.13.1",
"version": "1.13.2",
"homepage": "https://github.com/dominictarr/multiblob",

@@ -16,2 +16,3 @@ "repository": {

"pull-cat": "^1.1.8",
"pull-catch": "^1.0.0",
"pull-defer": "^0.2.2",

@@ -18,0 +19,0 @@ "pull-file": "^0.5.0",

@@ -15,5 +15,11 @@ var tape = require('tape')

var l = 100, random1 = []
while(l --) random1.push(crypto.randomBytes(1024))
var l = 100
random1 = []
random2 = []
while (l--) {
random1.push(crypto.randomBytes(1024))
random2.push(crypto.randomBytes(1024))
}
module.exports = function (alg) {

@@ -30,2 +36,3 @@

var hash1 = hasher(random1)
var hash2 = hasher(random2)

@@ -50,2 +57,18 @@ tape('read a slice', function (t) {

tape('error if requested hash is missing', function (t) {
pull(
pull(blobs.get(hash2)),
pull.collect(function (err) {
for (var key in err) {
console.log(key, err[key])
}
t.ok(err, 'error message exists')
t.equal(err.code, 'ENOENT', 'error code is unchanged')
t.equal(err.message, 'could not get blob', 'error message is correctly delcared')
t.end()
})
)
})
tape('error if requested size is incorrect', function (t) {

@@ -52,0 +75,0 @@ pull(

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