| Current Path : /home/emeraadmin/www/4d695/ |
| Current File : /home/emeraadmin/www/4d695/rw.zip |
PK E[�\�ڤ�� � package.jsonnu �[��� {
"_args": [
[
"rw@1.3.3",
"C:\\Users\\Ovi-PC\\Downloads\\themekit-master\\themekit"
]
],
"_from": "rw@1.3.3",
"_id": "rw@1.3.3",
"_inBundle": false,
"_integrity": "sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q=",
"_location": "/rw",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "rw@1.3.3",
"name": "rw",
"escapedName": "rw",
"rawSpec": "1.3.3",
"saveSpec": null,
"fetchSpec": "1.3.3"
},
"_requiredBy": [
"/d3-dsv"
],
"_resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz",
"_spec": "1.3.3",
"_where": "C:\\Users\\Ovi-PC\\Downloads\\themekit-master\\themekit",
"author": {
"name": "Mike Bostock",
"url": "http://bost.ocks.org/mike"
},
"bugs": {
"url": "https://github.com/mbostock/rw/issues"
},
"description": "Now stdin and stdout are files.",
"devDependencies": {
"d3-queue": "3",
"eslint": "3"
},
"homepage": "https://github.com/mbostock/rw",
"keywords": [
"fs",
"readFile",
"writeFile",
"stdin",
"stdout"
],
"license": "BSD-3-Clause",
"main": "index.js",
"name": "rw",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/mbostock/rw.git"
},
"scripts": {
"postpublish": "git push && git push --tags",
"prepublish": "npm test",
"test": "test/run-tests && eslint index.js lib"
},
"version": "1.3.3"
}
PK E[�\��X X lib/rw/write-file-sync.jsnu �[��� var fs = require("fs"),
encode = require("./encode");
module.exports = function(filename, data, options) {
var stat;
try {
stat = fs.statSync(filename);
} catch (error) {
if (error.code !== "ENOENT") throw error;
}
if (!stat || stat.isFile()) {
fs.writeFileSync(filename, data, options);
} else {
var fd = fs.openSync(filename, options && options.flag || "w"),
bytesWritten = 0,
bytesTotal = (data = encode(data, options)).length;
while (bytesWritten < bytesTotal) {
try {
bytesWritten += fs.writeSync(fd, data, bytesWritten, bytesTotal - bytesWritten, null);
} catch (error) {
if (error.code === "EPIPE") break; // ignore broken pipe, e.g., | head
fs.closeSync(fd);
throw error;
}
}
fs.closeSync(fd);
}
};
PK E[�\ ��W W lib/rw/decode.jsnu �[��� module.exports = function(options) {
if (options) {
if (typeof options === "string") return encoding(options);
if (options.encoding !== null) return encoding(options.encoding);
}
return identity();
};
function identity() {
var chunks = [];
return {
push: function(chunk) { chunks.push(chunk); },
value: function() { return Buffer.concat(chunks); }
};
}
function encoding(encoding) {
var chunks = [];
return {
push: function(chunk) { chunks.push(chunk); },
value: function() { return Buffer.concat(chunks).toString(encoding); }
};
}
PK E[�\�8�# # lib/rw/read-file-sync.jsnu �[��� var fs = require("fs"),
decode = require("./decode");
module.exports = function(filename, options) {
if (fs.statSync(filename).isFile()) {
return fs.readFileSync(filename, options);
} else {
var fd = fs.openSync(filename, options && options.flag || "r"),
decoder = decode(options);
while (true) { // eslint-disable-line no-constant-condition
try {
var buffer = new Buffer(bufferSize),
bytesRead = fs.readSync(fd, buffer, 0, bufferSize);
} catch (e) {
if (e.code === "EOF") break;
fs.closeSync(fd);
throw e;
}
if (bytesRead === 0) break;
decoder.push(buffer.slice(0, bytesRead));
}
fs.closeSync(fd);
return decoder.value();
}
};
var bufferSize = 1 << 16;
PK E[�\LY)f, , lib/rw/write-file.jsnu �[��� var fs = require("fs"),
encode = require("./encode");
module.exports = function(path, data, options, callback) {
if (arguments.length < 4) callback = options, options = null;
switch (path) {
case "/dev/stdout": return writeStream(process.stdout, "write", data, options, callback);
case "/dev/stderr": return writeStream(process.stderr, "write", data, options, callback);
}
fs.stat(path, function(error, stat) {
if (error && error.code !== "ENOENT") return callback(error);
if (stat && stat.isFile()) return fs.writeFile(path, data, options, callback);
writeStream(fs.createWriteStream(path, options ? {flags: options.flag || "w"} : {}), "end", data, options, callback); // N.B. flag / flags
});
};
function writeStream(stream, send, data, options, callback) {
stream.on("error", function(error) { callback(error.code === "EPIPE" ? null : error); }); // ignore broken pipe, e.g., | head
stream[send](encode(data, options), function(error) { callback(error && error.code === "EPIPE" ? null : error); });
}
PK E[�\<Ҏ� � lib/rw/encode.jsnu �[��� module.exports = function(data, options) {
return typeof data === "string"
? new Buffer(data, typeof options === "string" ? options
: options && options.encoding !== null ? options.encoding
: "utf8")
: data;
};
PK E[�\4s��8 8 lib/rw/read-file.jsnu �[��� var fs = require("fs"),
decode = require("./decode");
module.exports = function(path, options, callback) {
if (arguments.length < 3) callback = options, options = null;
switch (path) {
case "/dev/stdin": return readStream(process.stdin, options, callback);
}
fs.stat(path, function(error, stat) {
if (error) return callback(error);
if (stat.isFile()) return fs.readFile(path, options, callback);
readStream(fs.createReadStream(path, options ? {flags: options.flag || "r"} : {}), options, callback); // N.B. flag / flags
});
};
function readStream(stream, options, callback) {
var decoder = decode(options);
stream.on("error", callback);
stream.on("data", function(d) { decoder.push(d); });
stream.on("end", function() { callback(null, decoder.value()); });
}
PK E[�\<� lib/rw/dash.jsnu �[��� var slice = Array.prototype.slice;
function dashify(method, file) {
return function(path) {
var argv = arguments;
if (path == "-") (argv = slice.call(argv)).splice(0, 1, file);
return method.apply(null, argv);
};
}
exports.readFile = dashify(require("./read-file"), "/dev/stdin");
exports.readFileSync = dashify(require("./read-file-sync"), "/dev/stdin");
exports.writeFile = dashify(require("./write-file"), "/dev/stdout");
exports.writeFileSync = dashify(require("./write-file-sync"), "/dev/stdout");
PK E[�\��Ӻ � test/encode-object-asyncnu �[��� #!/usr/bin/env node
var rw = require("../").dash;
rw.writeFile(process.argv[2] || "-", "gréén\n", {encoding: process.argv[3]}, function(error) {
if (error) throw error;
});
PK E[�\'ڄ� �
test/cat-syncnu �[��� #!/usr/bin/env node
var rw = require("../").dash;
rw.writeFileSync("-", rw.readFileSync(process.argv[2] || "-", "utf8"), "utf8");
PK E[�\�0�L L test/encoding-asyncnu �[��� #!/usr/bin/env node
var fs = require("fs"),
queue = require("d3-queue").queue,
rw = require("../");
var code = 0;
queue(1)
.defer(testRead, "utf8", "gréén\n")
.defer(testRead, {encoding: "utf8"}, "gréén\n")
.defer(testRead, "ascii", "grC)C)n\n")
.defer(testRead, {encoding: "ascii"}, "grC)C)n\n")
.defer(testWrite, "utf8", "gréén\n")
.defer(testWrite, {encoding: "utf8"}, "gréén\n")
.defer(testWrite, "ascii", "gr��n\n")
.defer(testWrite, {encoding: "ascii"}, "gr��n\n")
.await(done);
function testRead(options, expected, callback) {
rw.readFile("test/utf8.txt", options, function(error, actual) {
if (error) return void callback(error);
if (actual !== expected) console.warn(actual + " !== " + expected), code = 1;
callback(null);
});
}
function testWrite(options, expected, callback) {
rw.writeFile("test/encoding-async.out", "gréén\n", options, function(error) {
if (error) return void callback(error);
fs.readFile("test/encoding-async.out", "utf8", function(error, actual) {
if (error) return void callback(error);
if (actual !== expected) console.warn(actual + " !== " + expected), code = 1;
callback(null);
});
});
}
function done(error) {
if (error) throw error;
process.exit(code);
}
PK E[�\�yQ� � test/write-asyncnu �[��� #!/usr/bin/env node
var rw = require("../").dash;
rw.writeFile(process.argv[2] || "-", "Hello, world!", "utf8", function(error) {
if (error) throw error;
});
PK E[�\{X�R R test/encoding-syncnu �[��� #!/usr/bin/env node
var fs = require("fs"),
rw = require("../");
var code = 0,
actual,
expected;
if ((actual = rw.readFileSync("test/utf8.txt", "utf8")) !== (expected = "gréén\n")) code = 1, console.warn(actual + " !== " + expected);
if ((actual = rw.readFileSync("test/utf8.txt", {encoding: "utf8"})) !== (expected = "gréén\n")) code = 1, console.warn(actual + " !== " + expected);
if ((actual = rw.readFileSync("test/utf8.txt", "ascii")) !== (expected = "grC)C)n\n")) code = 1, console.warn(actual + " !== " + expected);
if ((actual = rw.readFileSync("test/utf8.txt", {encoding: "ascii"})) !== (expected = "grC)C)n\n")) code = 1, console.warn(actual + " !== " + expected);
rw.writeFileSync("test/encoding-sync.out", "gréén\n", "utf8"); if ((actual = fs.readFileSync("test/encoding-sync.out", "utf8")) !== (expected = "gréén\n")) code = 1, console.warn(actual + " !== " + expected);
rw.writeFileSync("test/encoding-sync.out", "gréén\n", {encoding: "utf8"}); if ((actual = fs.readFileSync("test/encoding-sync.out", "utf8")) !== (expected = "gréén\n")) code = 1, console.warn(actual + " !== " + expected);
rw.writeFileSync("test/encoding-sync.out", "gréén\n", "ascii"); if ((actual = fs.readFileSync("test/encoding-sync.out", "utf8")) !== (expected = "gr��n\n")) code = 1, console.warn(actual + " !== " + expected);
rw.writeFileSync("test/encoding-sync.out", "gréén\n", {encoding: "ascii"}); if ((actual = fs.readFileSync("test/encoding-sync.out", "utf8")) !== (expected = "gr��n\n")) code = 1, console.warn(actual + " !== " + expected);
process.exit(code);
PK E[�\�|z
test/utf8.txtnu �[��� gréén
PK E[�\/��/| | test/write-syncnu �[��� #!/usr/bin/env node
var rw = require("../").dash;
rw.writeFileSync(process.argv[2] || "-", "Hello, world!", "utf8");
PK E[�\#e�� �
test/wc-asyncnu �[��� #!/usr/bin/env node
var rw = require("../").dash;
rw.readFile(process.argv[2] || "-", function(error, contents) {
if (error) throw error;
console.log(contents.length);
});
PK E[�\V�*؍ � test/encode-object-syncnu �[��� #!/usr/bin/env node
var rw = require("../").dash;
rw.writeFileSync(process.argv[2] || "-", "gréén\n", {encoding: process.argv[3]});
PK E[�\��~ ~ test/wc-syncnu �[��� #!/usr/bin/env node
var rw = require("../").dash;
console.log(rw.readFileSync(process.argv[2] || "-", "utf8").length);
PK E[�\�A|�X X test/run-testsnu �[��� #!/bin/bash
FILE=test/input.txt
rm -f -- $FILE
for i in {1..10000}; do printf '%09X\n' $RANDOM >> $FILE; done
function test()
{
if [[ $1 -eq 0 ]]
then
echo -e "\x1B[1;32m✓ $2\x1B[0m"
else
echo -e "\x1B[1;31m✗ $2\x1B[0m"
fi
}
test/encoding-sync; test $? "encoding-sync applies the specified encodings"
test/encoding-async; test $? "encoding-async applies the specified encodings"
[ "$(test/wc-async $FILE)" = "100000" ]; test $? "wc-async reads an entire file"
[ "$(test/wc-sync $FILE)" = "100000" ]; test $? "wc-sync reads an entire file"
[ "$(test/wc-async < $FILE)" = "100000" ]; test $? "wc-async reads an entire file from stdin"
[ "$(test/wc-sync < $FILE)" = "100000" ]; test $? "wc-sync reads an entire file from stdin"
[ "$(cat $FILE | test/wc-async)" = "100000" ]; test $? "wc-async reads an entire file from a pipe"
[ "$(cat $FILE | test/wc-sync)" = "100000" ]; test $? "wc-sync reads an entire file from a pipe"
[ "$(test/cat-async $FILE | wc -c | tr -d ' ')" = "100000" ]; test $? "cat-async reads an entire file and writes it to a pipe"
[ "$(test/cat-sync $FILE | wc -c | tr -d ' ')" = "100000" ]; test $? "cat-sync reads an entire file and writes it to a pipe"
[ "$(test/cat-async $FILE | test/wc-async)" = "100000" ]; test $? "cat-async reads an entire file and writes it to a pipe to wc-async "
[ "$(test/cat-async $FILE | test/wc-sync)" = "100000" ]; test $? "cat-async reads an entire file and writes it to a pipe to wc-sync "
[ "$(test/cat-sync $FILE | test/wc-async)" = "100000" ]; test $? "cat-sync reads an entire file and writes it to a pipe to wc-async "
[ "$(test/cat-sync $FILE | test/wc-sync)" = "100000" ]; test $? "cat-sync reads an entire file and writes it to a pipe to wc-sync "
[ "$(test/cat-async < $FILE | wc -c | tr -d ' ')" = "100000" ]; test $? "cat-async reads an entire file from stdin and writes it to a pipe"
[ "$(test/cat-sync < $FILE | wc -c | tr -d ' ')" = "100000" ]; test $? "cat-sync reads an entire file from stdin and writes it to a pipe"
[ "$(test/cat-async < $FILE | test/wc-async)" = "100000" ]; test $? "cat-async reads an entire file from stdin and writes it to a pipe to wc-async"
[ "$(test/cat-async < $FILE | test/wc-sync)" = "100000" ]; test $? "cat-async reads an entire file from stdin and writes it to a pipe to wc-sync"
[ "$(test/cat-sync < $FILE | test/wc-async)" = "100000" ]; test $? "cat-sync reads an entire file from stdin and writes it to a pipe to wc-async"
[ "$(test/cat-sync < $FILE | test/wc-sync)" = "100000" ]; test $? "cat-sync reads an entire file from stdin and writes it to a pipe to wc-sync"
[ "$(cat $FILE | test/cat-async | test/wc-async)" = "100000" ]; test $? "cat-async reads an entire file from a pipe and writes it to a pipe to wc-async"
[ "$(cat $FILE | test/cat-async | test/wc-sync)" = "100000" ]; test $? "cat-async reads an entire file from a pipe and writes it to a pipe to wc-sync"
[ "$(cat $FILE | test/cat-sync | test/wc-async)" = "100000" ]; test $? "cat-sync reads an entire file from a pipe and writes it to a pipe to wc-async"
[ "$(cat $FILE | test/cat-sync | test/wc-sync)" = "100000" ]; test $? "cat-sync reads an entire file from a pipe and writes it to a pipe to wc-sync"
[ "$(cat $FILE | test/cat-async | head -n 100 | test/wc-async)" = "1000" ]; test $? "cat-async reads an entire file from a pipe and writes it to a pipe to head to wc-async"
[ "$(cat $FILE | test/cat-async | head -n 100 | test/wc-sync)" = "1000" ]; test $? "cat-async reads an entire file from a pipe and writes it to a pipe to head to wc-sync"
[ "$(cat $FILE | test/cat-sync | head -n 100 | test/wc-async)" = "1000" ]; test $? "cat-sync reads an entire file from a pipe and writes it to a pipe to head to wc-async"
[ "$(cat $FILE | test/cat-sync | head -n 100 | test/wc-sync)" = "1000" ]; test $? "cat-sync reads an entire file from a pipe and writes it to a pipe to head to wc-sync"
[ "$(cat $FILE 2> /dev/null | head -n 100 | test/cat-async | test/wc-async)" = "1000" ]; test $? "cat-async reads the head of a file from a pipe and writes it to wc-async"
[ "$(cat $FILE 2> /dev/null | head -n 100 | test/cat-async | test/wc-sync)" = "1000" ]; test $? "cat-async reads the head of a file from a pipe and writes it to wc-sync"
[ "$(cat $FILE 2> /dev/null | head -n 100 | test/cat-sync | test/wc-async)" = "1000" ]; test $? "cat-sync reads the head of a file from a pipe and writes it to wc-async"
[ "$(cat $FILE 2> /dev/null | head -n 100 | test/cat-sync | test/wc-sync)" = "1000" ]; test $? "cat-sync reads the head of a file from a pipe and writes it to wc-sync"
[ "$(test/write-async test/write.out && cat test/write.out)" = "Hello, world!" ]; test $? "write-async writes an entire file"
[ "$(test/write-sync test/write.out && cat test/write.out)" = "Hello, world!" ]; test $? "write-sync writes an entire file"
rm -f -- $FILE test/write.out test/encoding-sync.out test/encoding-async.out
PK E[�\�!�?� � test/encode-string-syncnu �[��� #!/usr/bin/env node
var rw = require("../").dash;
rw.writeFileSync(process.argv[2] || "-", "gréén\n", process.argv[3]);
PK E[�\��ݮ � test/encode-string-asyncnu �[��� #!/usr/bin/env node
var rw = require("../").dash;
rw.writeFile(process.argv[2] || "-", "gréén\n", process.argv[3], function(error) {
if (error) throw error;
});
PK E[�\����� � test/cat-asyncnu �[��� #!/usr/bin/env node
var rw = require("../").dash;
rw.readFile(process.argv[2] || "-", "utf8", function(error, contents) {
if (error) throw error;
rw.writeFile("-", contents, "utf8", function(error) {
if (error) throw error;
});
});
PK E[�\�eR�� � LICENSEnu �[��� Copyright (c) 2014-2016, Michael Bostock
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name Michael Bostock may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PK E[�\�^�<