Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorForrest L Norvell <forrest@npmjs.com>2014-11-28 05:06:19 +0300
committerForrest L Norvell <forrest@npmjs.com>2014-11-28 05:06:19 +0300
commit6a4ea054f6ddf52fc58842ba2046564b04c5c0e2 (patch)
treefd4bc6996fa70d215952d5cc5d5c15621f17592a /node_modules/fstream
parenta5586954f1c18df7c96137e0a79f41a69e7a884e (diff)
fstream@1.0.3
Properly propagate proper errors.
Diffstat (limited to 'node_modules/fstream')
-rw-r--r--node_modules/fstream/examples/filter-pipe.js4
-rw-r--r--node_modules/fstream/examples/pipe.js2
-rw-r--r--node_modules/fstream/examples/reader.js22
-rw-r--r--node_modules/fstream/lib/file-reader.js4
-rw-r--r--node_modules/fstream/package.json30
5 files changed, 32 insertions, 30 deletions
diff --git a/node_modules/fstream/examples/filter-pipe.js b/node_modules/fstream/examples/filter-pipe.js
index c6b55b3e0..983649bb9 100644
--- a/node_modules/fstream/examples/filter-pipe.js
+++ b/node_modules/fstream/examples/filter-pipe.js
@@ -4,8 +4,8 @@ var path = require("path")
var r = fstream.Reader({ path: path.dirname(__dirname)
, filter: function () {
return !this.basename.match(/^\./) &&
- !this.basename.match(/^node_modules$/)
- !this.basename.match(/^deep-copy$/)
+ !this.basename.match(/^node_modules$/) &&
+ !this.basename.match(/^deep-copy$/) &&
!this.basename.match(/^filter-copy$/)
}
})
diff --git a/node_modules/fstream/examples/pipe.js b/node_modules/fstream/examples/pipe.js
index 648ec8493..0bad122f9 100644
--- a/node_modules/fstream/examples/pipe.js
+++ b/node_modules/fstream/examples/pipe.js
@@ -4,7 +4,7 @@ var path = require("path")
var r = fstream.Reader({ path: path.dirname(__dirname)
, filter: function () {
return !this.basename.match(/^\./) &&
- !this.basename.match(/^node_modules$/)
+ !this.basename.match(/^node_modules$/) &&
!this.basename.match(/^deep-copy$/)
}
})
diff --git a/node_modules/fstream/examples/reader.js b/node_modules/fstream/examples/reader.js
index 9aa1a9538..3787ae376 100644
--- a/node_modules/fstream/examples/reader.js
+++ b/node_modules/fstream/examples/reader.js
@@ -2,13 +2,12 @@ var fstream = require("../fstream.js")
var tap = require("tap")
var fs = require("fs")
var path = require("path")
-var children = -1
var dir = path.dirname(__dirname)
-var gotReady = false
-var ended = false
-
tap.test("reader test", function (t) {
+ var children = -1
+ var gotReady = false
+ var ended = false
var r = fstream.Reader({ path: dir
, filter: function () {
@@ -52,3 +51,18 @@ tap.test("reader test", function (t) {
})
})
+
+tap.test("reader error test", function (t) {
+ // assumes non-root on a *nix system
+ var r = fstream.Reader({ path: '/etc/shadow' })
+
+ r.once("error", function (er) {
+ t.ok(true);
+ t.end()
+ })
+
+ r.on("end", function () {
+ t.fail("reader ended without error");
+ t.end()
+ })
+})
diff --git a/node_modules/fstream/lib/file-reader.js b/node_modules/fstream/lib/file-reader.js
index b1f986183..4720cd86a 100644
--- a/node_modules/fstream/lib/file-reader.js
+++ b/node_modules/fstream/lib/file-reader.js
@@ -80,6 +80,10 @@ FileReader.prototype._getStream = function () {
}
})
+ stream.on("error", function (e) {
+ me.emit("error", e);
+ });
+
me._read()
}
diff --git a/node_modules/fstream/package.json b/node_modules/fstream/package.json
index d0ac58243..f920c1003 100644
--- a/node_modules/fstream/package.json
+++ b/node_modules/fstream/package.json
@@ -6,7 +6,7 @@
},
"name": "fstream",
"description": "Advanced file system stream things",
- "version": "1.0.2",
+ "version": "1.0.3",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/fstream.git"
@@ -28,30 +28,14 @@
"test": "tap examples/*.js"
},
"license": "BSD",
- "gitHead": "b3b74e92ef4a91ae206fab90b7998c7cd2e4290d",
+ "readme": "Like FS streams, but with stat on them, and supporting directories and\nsymbolic links, as well as normal files. Also, you can use this to set\nthe stats on a file, even if you don't change its contents, or to create\na symlink, etc.\n\nSo, for example, you can \"write\" a directory, and it'll call `mkdir`. You\ncan specify a uid and gid, and it'll call `chown`. You can specify a\n`mtime` and `atime`, and it'll call `utimes`. You can call it a symlink\nand provide a `linkpath` and it'll call `symlink`.\n\nNote that it won't automatically resolve symbolic links. So, if you\ncall `fstream.Reader('/some/symlink')` then you'll get an object\nthat stats and then ends immediately (since it has no data). To follow\nsymbolic links, do this: `fstream.Reader({path:'/some/symlink', follow:\ntrue })`.\n\nThere are various checks to make sure that the bytes emitted are the\nsame as the intended size, if the size is set.\n\n## Examples\n\n```javascript\nfstream\n .Writer({ path: \"path/to/file\"\n , mode: 0755\n , size: 6\n })\n .write(\"hello\\n\")\n .end()\n```\n\nThis will create the directories if they're missing, and then write\n`hello\\n` into the file, chmod it to 0755, and assert that 6 bytes have\nbeen written when it's done.\n\n```javascript\nfstream\n .Writer({ path: \"path/to/file\"\n , mode: 0755\n , size: 6\n , flags: \"a\"\n })\n .write(\"hello\\n\")\n .end()\n```\n\nYou can pass flags in, if you want to append to a file.\n\n```javascript\nfstream\n .Writer({ path: \"path/to/symlink\"\n , linkpath: \"./file\"\n , SymbolicLink: true\n , mode: \"0755\" // octal strings supported\n })\n .end()\n```\n\nIf isSymbolicLink is a function, it'll be called, and if it returns\ntrue, then it'll treat it as a symlink. If it's not a function, then\nany truish value will make a symlink, or you can set `type:\n'SymbolicLink'`, which does the same thing.\n\nNote that the linkpath is relative to the symbolic link location, not\nthe parent dir or cwd.\n\n```javascript\nfstream\n .Reader(\"path/to/dir\")\n .pipe(fstream.Writer(\"path/to/other/dir\"))\n```\n\nThis will do like `cp -Rp path/to/dir path/to/other/dir`. If the other\ndir exists and isn't a directory, then it'll emit an error. It'll also\nset the uid, gid, mode, etc. to be identical. In this way, it's more\nlike `rsync -a` than simply a copy.\n",
+ "readmeFilename": "README.md",
+ "gitHead": "d205397b27d93eee5314e9d2d87693e82b560106",
"bugs": {
"url": "https://github.com/isaacs/fstream/issues"
},
"homepage": "https://github.com/isaacs/fstream",
- "_id": "fstream@1.0.2",
- "_shasum": "56930ff1b4d4d7b1a689c8656b3a11e744ab92c6",
- "_from": "fstream@1.0.2",
- "_npmVersion": "1.4.23",
- "_npmUser": {
- "name": "isaacs",
- "email": "i@izs.me"
- },
- "maintainers": [
- {
- "name": "isaacs",
- "email": "i@izs.me"
- }
- ],
- "dist": {
- "shasum": "56930ff1b4d4d7b1a689c8656b3a11e744ab92c6",
- "tarball": "http://registry.npmjs.org/fstream/-/fstream-1.0.2.tgz"
- },
- "directories": {},
- "_resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.2.tgz",
- "readme": "ERROR: No README data found!"
+ "_id": "fstream@1.0.3",
+ "_shasum": "5ce69767710d7a39c8cd9232470d9426790195da",
+ "_from": "fstream@>=1.0.3 <1.1.0"
}