|
@ -12,7 +12,7 @@ node.fs.cat = function (path, encoding, callback) { |
|
|
callback(-1); |
|
|
callback(-1); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var content = (encoding == node.constants.UTF8 ? "" : []); |
|
|
var content = (encoding == node.UTF8 ? "" : []); |
|
|
var pos = 0; |
|
|
var pos = 0; |
|
|
var chunkSize = 16*1024; |
|
|
var chunkSize = 16*1024; |
|
|
|
|
|
|
|
@ -41,9 +41,9 @@ node.fs.File = function (options) { |
|
|
options = options || {}; |
|
|
options = options || {}; |
|
|
|
|
|
|
|
|
if (options.encoding === "utf8") { |
|
|
if (options.encoding === "utf8") { |
|
|
self.encoding = node.constants.UTF8; |
|
|
self.encoding = node.UTF8; |
|
|
} else { |
|
|
} else { |
|
|
self.encoding = node.constants.RAW; |
|
|
self.encoding = node.RAW; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//node.debug("encoding: opts=" + options.encoding + " self=" + self.encoding);
|
|
|
//node.debug("encoding: opts=" + options.encoding + " self=" + self.encoding);
|
|
@ -104,22 +104,22 @@ node.fs.File = function (options) { |
|
|
var flags; |
|
|
var flags; |
|
|
switch (mode) { |
|
|
switch (mode) { |
|
|
case "r": |
|
|
case "r": |
|
|
flags = node.constants.O_RDONLY; |
|
|
flags = node.O_RDONLY; |
|
|
break; |
|
|
break; |
|
|
case "r+": |
|
|
case "r+": |
|
|
flags = node.constants.O_RDWR; |
|
|
flags = node.O_RDWR; |
|
|
break; |
|
|
break; |
|
|
case "w": |
|
|
case "w": |
|
|
flags = node.constants.O_CREAT | node.constants.O_TRUNC | node.constants.O_WRONLY; |
|
|
flags = node.O_CREAT | node.O_TRUNC | node.O_WRONLY; |
|
|
break; |
|
|
break; |
|
|
case "w+": |
|
|
case "w+": |
|
|
flags = node.constants.O_CREAT | node.constants.O_TRUNC | node.constants.O_RDWR; |
|
|
flags = node.O_CREAT | node.O_TRUNC | node.O_RDWR; |
|
|
break; |
|
|
break; |
|
|
case "a": |
|
|
case "a": |
|
|
flags = node.constants.O_APPEND | node.constants.O_CREAT | node.constants.O_WRONLY; |
|
|
flags = node.O_APPEND | node.O_CREAT | node.O_WRONLY; |
|
|
break; |
|
|
break; |
|
|
case "a+": |
|
|
case "a+": |
|
|
flags = node.constants.O_APPEND | node.constants.O_CREAT | node.constants.O_RDWR; |
|
|
flags = node.O_APPEND | node.O_CREAT | node.O_RDWR; |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
throw "Unknown mode"; |
|
|
throw "Unknown mode"; |
|
@ -173,9 +173,9 @@ node.fs.File = function (options) { |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
stdout = new node.fs.File({ fd: node.constants.STDOUT_FILENO }); |
|
|
stdout = new node.fs.File({ fd: node.STDOUT_FILENO }); |
|
|
stderr = new node.fs.File({ fd: node.constants.STDERR_FILENO }); |
|
|
stderr = new node.fs.File({ fd: node.STDERR_FILENO }); |
|
|
stdin = new node.fs.File({ fd: node.constants.STDIN_FILENO }); |
|
|
stdin = new node.fs.File({ fd: node.STDIN_FILENO }); |
|
|
|
|
|
|
|
|
puts = stdout.puts; |
|
|
puts = stdout.puts; |
|
|
print = stdout.print; |
|
|
print = stdout.print; |
|
|