filer/examples/test5.html

29 lines
496 B
HTML
Raw Normal View History

2013-05-30 18:57:33 +00:00
var write_buffer = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
var read_buffer = new Uint8Array(16);
2013-05-30 18:57:33 +00:00
var fs = new FileSystem('local');
fs.then(
function() {
return this.mkdir('/tmp');
}
);
2013-05-30 18:57:33 +00:00
var fd = fs.open('/myfile.txt', fs.RW);
2013-05-30 18:57:33 +00:00
fd.then(
function() {
return this.write(write_buffer);
}
).then(
function(nbytes) {
this.seek(-nbytes);
return this.read(read_buffer);
}
).then(
function(nbytes) {
console.log(read_buffer);
}
);
});