Bar graph added.

This commit is contained in:
prabhatdev
2020-07-28 00:48:25 +05:30
parent d0a6e2667d
commit 194b41124d
3468 changed files with 640611 additions and 169 deletions

14
node_modules/rw/lib/rw/dash.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
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");

23
node_modules/rw/lib/rw/decode.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
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); }
};
}

7
node_modules/rw/lib/rw/encode.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
module.exports = function(data, options) {
return typeof data === "string"
? new Buffer(data, typeof options === "string" ? options
: options && options.encoding !== null ? options.encoding
: "utf8")
: data;
};

29
node_modules/rw/lib/rw/read-file-sync.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
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;

23
node_modules/rw/lib/rw/read-file.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
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()); });
}

32
node_modules/rw/lib/rw/write-file-sync.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
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);
}
};

22
node_modules/rw/lib/rw/write-file.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
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); });
}