filer/examples/test5.html

29 lines
496 B
HTML

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);
var fs = new FileSystem('local');
fs.then(
function() {
return this.mkdir('/tmp');
}
);
var fd = fs.open('/myfile.txt', fs.RW);
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);
}
);
});