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

bluesky

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bluesky - npm Package Compare versions

Comparing version 0.6.7 to 0.7.0

45

lib/blob.js

@@ -230,45 +230,24 @@ /*!

Container.prototype.get = function(name, callback) {
Container.prototype.get = function(name) {
var blobReadStream = new BlobReadStream();
var s = new BlobReadStream();
var svc = Object.create(this.options.blobService);
var s1 = this.options.blobService.getBlob(this.name, name, function(err, r) {
svc.on('response', function(response) {
var metadata = r.metadata || {};
delete r['metadata'];
var properties = new BlobResult();
properties.getPropertiesFromHeaders(response.headers);
s.metadata = metadata;
s.properties = r;
s.emit('details',{properties: r, metadata: metadata});
var metadata = svc.parseMetadataHeaders(response.headers);
s.done();
blobReadStream.properties = properties;
blobReadStream.metadata = metadata;
if (callback) {
callback(null,blobReadStream);
blobReadStream.ready();
}
blobReadStream.emit('details', {properties: properties, metadata: metadata});
});
try {
s1.pipe(s);
svc.getBlobToStream(this.name, name, blobReadStream, function() {});
return s;
if (!callback) {
blobReadStream.ready();
return(blobReadStream);
}
} catch (err) {
if (callback) {
callback(err,null);
} else {
// Will we ever actually return blobReadStream in the case of this error? Probably not.
blobReadStream.emit('error', err);
}
}
};

@@ -275,0 +254,0 @@

@@ -7,4 +7,2 @@ /*!

// heavily influenced by https://github.com/felixge/node-passthrough-stream
var Stream = require('stream').Stream;

@@ -17,40 +15,17 @@ var util = require('util');

this.readable = true;
this.isReady = false;
this.properties = {};
this.metadata = {};
this.buffer = null;
this.readyToEnd = false;
}
util.inherits(BlobReadStream, Stream);
BlobReadStream.prototype.write = function(data) {
if (this.isReady) {
this.emit('data',data);
return true;
} else {
this.buffer = data;
return false;
}
};
this.emit('data',data);
}
BlobReadStream.prototype.ready = function() {
if (this.buffer !== null) {
this.emit('data',this.buffer);
this.buffer = null;
this.emit('drain');
}
if (this.readyToEnd) {
BlobReadStream.prototype.done = function() {
this.emit('end');
} else {
this.isReady = true;
}
}
BlobReadStream.prototype.end = function(data) {
if (this.buffer === null) {
this.writable = false;
this.emit('end');
} else {
this.readyToEnd = true;
if (data) {
this.emit('data',data);
}

@@ -57,0 +32,0 @@ };

@@ -9,3 +9,3 @@ /*!

var TableQuery = require("azure/lib/services/table/tablequery");
var ISO8061Date = require("azure/lib/util/iso8061date");
var ISO8061Date = require("azure-common/lib/util/iso8061date");
var EventEmitter = require('events').EventEmitter;

@@ -12,0 +12,0 @@ var skyutil = require('./util');

@@ -15,3 +15,3 @@ {

"dependencies": {
"memorystream" : "0.0.x",
"memorystream" : "0.2.x",
"mime": "1.x.x",

@@ -27,3 +27,3 @@ "node-uuid": "1.x.x",

"engine": "node >= 0.6.0 <= 0.10.0",
"version": "0.6.7",
"version": "0.7.0",
"files": [

@@ -30,0 +30,0 @@ "index.js",

@@ -56,7 +56,1 @@ # node-bluesky

* [pofallon/loremipstream](/pofallon/loremipstream)
## Special Thanks
…to Cerebrata for [Cloud Storage Studio](http://www.cerebrata.com/products/cloudstoragestudio/) - an indispensible tool (along with [fiddler2](http://www.fiddler2.com/fiddler2/)) in the node-bluesky debugging process!
[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/45298f46f07f1fbc9faa638f2bccdc8a "githalytics.com")](http://githalytics.com/pofallon/node-bluesky)

@@ -110,51 +110,29 @@ /*!

// Need to give it a second because immediately
// 'get'-ing the blob sometimes returns not found
var memStream = new MemoryStream(null, {readable: false});
test.expect(4);
setTimeout(function() {
var memStream = new MemoryStream(null, {readable: false});
var c = storage.container(that.containerName);
c.get('blob.txt', function(err,s) {
test.equals(err,null);
test.notEqual(s,null);
if (s) {
test.deepEqual(s.metadata,{'foo1':'bar1'});
s.on("error", function(error) {
test.equals(error,null,'Stream emitted an error event.');
test.done();
});
s.on("end", function() {
test.equals(memStream.getAll(),'This is a text blob');
test.done();
});
s.pipe(memStream);
}
});
var s = c.get('blob.txt');
test.notEqual(s,null);
if (s) {
s.on("details", function(details) {
test.equals(details.properties.blobType,'BlockBlob');
test.deepEqual(details.metadata,{'foo1':'bar1'});
});
s.on("error", function(error) {
test.equals(error,null,'Stream emitted an error event.');
test.done();
});
s.on("end", function() {
test.equals(memStream.getAll(),'This is a text blob');
test.done();
});
s.pipe(memStream);
}
}, 1000);
},
blobDirectGet: function (test) {
var memStream = new MemoryStream(null, {readable: false});
var c = storage.container(this.containerName);
var s = c.get('blob.txt');
test.notEqual(s,null);
if (s) {
s.on("details", function(details) {
test.equals(details.properties.blobType,'BlockBlob');
test.deepEqual(details.metadata,{'foo1':'bar1'});
});
s.on("error", function(error) {
test.equals(error,null,'Stream emitted an error event.');
test.done();
});
s.on("end", function() {
test.equals(memStream.getAll(),'This is a text blob');
test.done();
});
s.pipe(memStream);
}
},

@@ -169,22 +147,18 @@

var m1 = new MemoryStream(null, {readable: false});
c.get('blob.txt', function(err,s1) {
test.equals(err,null);
test.notEqual(s1,null);
s1.on("end", function() {
setTimeout(function() {
var m2 = new MemoryStream(null, {readable: false});
c.get('blob2.txt', function(err,s2) {
test.equals(err,null);
test.notEqual(s2,null);
test.deepEqual(s2.metadata,{'foo1':'bar1'});
s2.on("end", function() {
test.equals(m1.getAll(), m2.getAll());
test.done();
});
s2.pipe(m2);
});
}, 1000);
});
s1.pipe(m1);
var s1 = c.get('blob.txt');
test.notEqual(s1,null);
s1.on("end", function() {
setTimeout(function() {
var m2 = new MemoryStream(null, {readable: false});
var s2 = c.get('blob2.txt');
test.notEqual(s2,null);
s2.on("end", function() {
test.deepEqual(s2.metadata,{'foo1':'bar1'});
test.equals(m1.getAll(), m2.getAll());
test.done();
});
s2.pipe(m2);
}, 1000);
});
s1.pipe(m1);
});

@@ -195,8 +169,5 @@ s.on('error', function(err) {

});
c.get('blob.txt', function(err,b) {
test.equals(err,null);
test.notEqual(b,null);
b.pipe(s);
});
b = c.get('blob.txt');
test.notEqual(b,null);
b.pipe(s);
},

@@ -203,0 +174,0 @@

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