Socket
Socket
Sign inDemoInstall

q-io

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

q-io - npm Package Compare versions

Comparing version 1.10.1 to 1.10.2

spec/fs/mock/stat-spec.js

35

fs-common.js

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

var Q = require("q");

@@ -238,3 +237,3 @@ var Boot = require("./fs-boot");

at.push(part);
var parts = self.join(at);
var parts = self.join(at) || ".";
var made = self.makeDirectory(parts, mode);

@@ -255,3 +254,3 @@ return Q.when(made, null, function rejected(error) {

var self = this;
return Q.when(self.stat(path), function (stat) {
return Q.when(self.statLink(path), function (stat) {
if (stat.isSymbolicLink()) {

@@ -464,3 +463,33 @@ return self.remove(path);

exports.Stats = Stats;
function Stats(nodeStat) {
this.node = nodeStat;
this.size = nodeStat.size;
}
var stats = [
"isDirectory",
"isFile",
"isBlockDevice",
"isCharacterDevice",
"isSymbolicLink",
"isFIFO",
"isSocket"
];
stats.forEach(function (name) {
Stats.prototype[name] = function () {
return this.node[name]();
};
});
Stats.prototype.lastModified = function () {
return new Date(this.node.mtime);
};
Stats.prototype.lastAccessed = function () {
return new Date(this.node.atime);
};
}

15

fs-mock.js

@@ -196,3 +196,3 @@

path = self.absolute(path);
return self._root._walk(path)._follow(path);
return new self.Stats(self._root._walk(path)._follow(path));
});

@@ -206,5 +206,2 @@ };

var node = self._root._walk(path);
if (!node.isSymbolicLink()) {
throw new Error("Path is not symbolic link: " + JSON.stringify(path));
}
return node;

@@ -451,2 +448,12 @@ });

Object.defineProperty(FileNode.prototype, "size", {
configurable: true,
enumerable: true,
get: function () {
return this._chunks.reduce(function (size, chunk) {
return size += chunk.length;
}, 0);
}
});
function DirectoryNode(fs) {

@@ -453,0 +460,0 @@ Node.call(this, fs);

@@ -194,3 +194,3 @@ /**

} else {
done.resolve(new Stats(stat));
done.resolve(new self.Stats(stat));
}

@@ -204,31 +204,2 @@ });

var Stats = function (nodeStat) {
this.node = nodeStat;
this.size = nodeStat.size;
};
var stats = [
"isDirectory",
"isFile",
"isBlockDevice",
"isCharacterDevice",
"isSymbolicLink",
"isFIFO",
"isSocket"
];
stats.forEach(function (name) {
Stats.prototype[name] = function () {
return this.node[name]();
};
});
Stats.prototype.lastModified = function () {
return new Date(this.node.mtime);
};
Stats.prototype.lastAccessed = function () {
return new Date(this.node.atime);
};
exports.statLink = function (path) {

@@ -235,0 +206,0 @@ path = String(path);

{
"name": "q-io",
"version": "1.10.1",
"version": "1.10.2",
"description": "IO using Q promises",

@@ -5,0 +5,0 @@ "homepage": "http://github.com/kriskowal/q-io/",

@@ -85,3 +85,9 @@ "use strict";

});
it("should tolerate .", function () {
return Q.fcall(function () {
return FS.makeTree(".");
})
});
});

@@ -14,2 +14,6 @@

module.exports = Writer;
var version = process.versions.node.split('.');
var supportsFinish = version[0] >= 0 && version[1] >= 10;
function Writer(_stream, charset) {

@@ -21,7 +25,5 @@ var self = Object.create(Writer.prototype);

var begin = Q.defer();
var drained = Q.defer();
_stream.on("error", function (reason) {
begin.reject(reason);
drained.reject(reason);

@@ -32,3 +34,2 @@ drained = Q.defer();

_stream.on("drain", function () {
begin.resolve(self);
drained.resolve();

@@ -77,5 +78,21 @@ drained = Q.defer();

self.close = function () {
var finished;
if (supportsFinish) { // new Streams, listen for `finish` event
finished = Q.defer();
_stream.on("finish", function () {
finished.resolve();
});
_stream.on("error", function (reason) {
finished.reject(reason);
});
}
_stream.end();
drained.resolve(); // we will get no further drain events
return Q.resolve(); // closing not explicitly observable
if (finished) { // closing not explicitly observable
return finished.promise;
} else {
return Q(); // just resolve for old Streams
}
};

@@ -96,4 +113,4 @@

return Q.resolve(self); // todo returns the begin.promise
return Q(self); // todo returns the begin.promise
}

Sorry, the diff of this file is not supported yet

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