Socket
Socket
Sign inDemoInstall

random-access-storage

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-access-storage - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

11

index.js

@@ -114,4 +114,11 @@ var events = require('events')

this._callback = cb
this._openError = null
}
Request.prototype._maybeOpenError = function (err) {
if (this.type !== 0) return
var queued = this.storage._queued
for (var i = 0; i < queued.length; i++) queued[i]._openError = err
}
Request.prototype._unqueue = function (err) {

@@ -144,2 +151,4 @@ var ra = this.storage

}
} else {
this._maybeOpenError(err)
}

@@ -160,3 +169,3 @@

if (ra.opened && !ra.closed) return true
if (!ra.opened) nextTick(this, new Error('Not opened'))
if (!ra.opened) nextTick(this, this._openError || new Error('Not opened'))
else if (ra.closed) nextTick(this, new Error('Closed'))

@@ -163,0 +172,0 @@ return false

2

package.json
{
"name": "random-access-storage",
"version": "1.2.0",
"version": "1.3.0",
"description": "Easily make random-access-storage instances",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -416,1 +416,24 @@ var tape = require('tape')

})
tape('open error forwarded to dependents', function (t) {
var s = ras({
open: req => req.callback(new Error('Nope')),
read: req => req.callback(null, Buffer.from('hi')),
write: req => req.callback(null, null)
})
s.write(0, Buffer.from('hi'), function (err) {
t.ok(err)
t.same(err.message, 'Nope')
})
s.read(0, 2, function (err) {
t.ok(err)
t.same(err.message, 'Nope')
})
s.close(function (err) {
t.ok(!err)
t.end()
})
})
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