mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
remove the callback from node.cat, node.fs.cat
This commit is contained in:
1 parent
b07dc31e1b
commit
e8a5d3d311
2 files changed
+4
-4
No files matched your search
+2
-2
@@ -4,7 +4,7 @@ node.fs.exists = function (path, callback) {
|
||||
p.addErrback(function () { callback(false); });
|
||||
}
|
||||
|
||||
node.fs.cat = function (path, encoding, callback) {
|
||||
node.fs.cat = function (path, encoding) {
|
||||
var open_promise = node.fs.open(path, node.O_RDONLY, 0666);
|
||||
var cat_promise = new node.Promise();
|
||||
|
||||
@@ -12,7 +12,7 @@ node.fs.cat = function (path, encoding, callback) {
|
||||
|
||||
open_promise.addErrback(function () { cat_promise.emitError(); });
|
||||
open_promise.addCallback(function (fd) {
|
||||
var content = (encoding == node.UTF8 ? "" : []);
|
||||
var content = (encoding === node.UTF8 ? "" : []);
|
||||
var pos = 0;
|
||||
|
||||
function readChunk () {
|
||||
|
||||
+2
-2
@@ -24,10 +24,10 @@ node.encodeUtf8 = function (array) {
|
||||
return String.fromCharCode.apply(String, array);
|
||||
};
|
||||
|
||||
node.cat = function(location, encoding, callback) {
|
||||
node.cat = function(location, encoding) {
|
||||
var url_re = new RegExp("^http:\/\/");
|
||||
var f = url_re.exec(location) ? node.http.cat : node.fs.cat;
|
||||
return f(location, encoding, callback);
|
||||
return f(location, encoding);
|
||||
};
|
||||
|
||||
node.path = new function () {
|
||||
|
||||
Reference in new issue
Block a user