Slide 26
Slide 26 text
backpressure 付き writable
fileStream = new WritableStream({
start() {
return fs.open(filename, "w").then(result => {
this.fd = result;
});
},
write(chunk) { // promise を返す
return fs.write(this.fd, chunk, 0, chunk.length);
}
close() {
return fs.close(this.fd);
}
});
26