0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/simple.js

19 lines
469 B
JavaScript
Raw Normal View History

2009-04-16 11:37:44 +02:00
var f = new File;
f.open("/tmp/world", "r+", function (status) {
if (status == 0) {
stdout.puts("file open");
f.write("hello world\n")
f.write("something else.\n", function () {
stdout.puts("written. ");
});
f.read(100, function (status, buf) {
stdout.puts("read: >>" + buf.encodeUtf8() + "<<");
});
} else {
stdout.puts("file open failed: " + status.toString());
}
f.close(function () { stdout.puts("closed.") });
});