mirror of https://github.com/lukechilds/node.git
Ryan
16 years ago
4 changed files with 64 additions and 0 deletions
@ -0,0 +1,21 @@ |
|||
var filename = ARGV[2]; |
|||
|
|||
function cat (file) { |
|||
file.read(100, function (status, data) { |
|||
if (status == 0 && data) { |
|||
stdout.write(data.encodeUtf8()); |
|||
cat(file); |
|||
} else { |
|||
file.close(); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
var f = new File; |
|||
f.open(filename, "r", function (status) { |
|||
puts("open!"); |
|||
if (status == 0) |
|||
cat(f); |
|||
else |
|||
puts("error?"); |
|||
}) |
@ -0,0 +1,14 @@ |
|||
File.stat(ARGV[2], function (status, stats) { |
|||
if (status == 0) { |
|||
for (var i in stats) { |
|||
puts(i + " : " + stats[i]); |
|||
} |
|||
} else { |
|||
puts("error: " + File.strerror(status)); |
|||
} |
|||
}); |
|||
|
|||
|
|||
File.exists(ARGV[2], function (r) { |
|||
puts("file exists: " + r); |
|||
}); |
Loading…
Reference in new issue