New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

queued-chunk-store

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

queued-chunk-store - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

18

index.js

@@ -0,1 +1,2 @@

var async = require('async')
module.exports = QueuedChunkStore

@@ -28,8 +29,21 @@

if (isArray(queuedGetsAtIndex)) {
var callbacks = [];
for (var i = 0; i < queuedGetsAtIndex.length; i++) {
var queuedGet = queuedGetsAtIndex[i];
self.store.get(index, queuedGet.opts, queuedGet.cb);
(function(queuedGet) {
callbacks.push(function (callback) {
self.store.get(index, queuedGet.opts, function(err, buf) {
queuedGet.cb(err, buf)
callback(err, buf)
})
})
})(queuedGet)
}
async.parallel(callbacks, function() {
self.queuedGets[index] = []
if (cb) cb(null);
});
return;
}
if (cb) cb(null);

@@ -36,0 +50,0 @@ })

5

package.json
{
"name": "queued-chunk-store",
"version": "1.1.0",
"version": "1.2.0",
"description": "Queued .get for abstract-chunk-store compliant stores",

@@ -31,3 +31,6 @@ "main": "index.js",

"test": "node test"
},
"dependencies": {
"async": "^2.0.0-rc.3"
}
}

@@ -26,5 +26,24 @@ var abstractTests = require('abstract-chunk-store/tests')

t.deepEqual(buf, new Buffer('0123456789'))
t.end()
})
store.get(1, function(err, buf) {
store.put(0, new Buffer('0123456789'))
})
test('put then get', function (t) {
var store = new Queued(Immediate(MemoryChunkStore(10)))
store.put(0, new Buffer('0123456789'), function() {
store.get(0, function(err, buf) {
t.error(err)
t.deepEqual(buf, new Buffer('0123456789'))
t.end()
})
})
})
test('gets should be removed after put', function (t) {
var store = new Queued(new MemoryChunkStore(10))
store.get(0, function(err, buf) {
t.error(err)

@@ -34,7 +53,15 @@ t.deepEqual(buf, new Buffer('0123456789'))

store.put(0, new Buffer('0123456789'))
store.get(0, function(err, buf) {
t.error(err)
t.deepEqual(buf, new Buffer('0123456789'))
})
store.put(1, new Buffer('0123456789'))
store.put(0, new Buffer('0123456789'), function() {
t.equal(store.queuedGets[0].length, 0)
t.end()
store.destroy(function (err) {
t.error(err)
t.end()
})
})
})

Sorry, the diff of this file is not supported yet

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