Complete the code to create a writable stream to a file named 'output.txt'.
import { createWriteStream } from 'fs'; const writable = createWriteStream([1]);
The createWriteStream function needs the filename where data will be written. Here, 'output.txt' is the correct target file.
Complete the code to write the string 'Hello, world!' to the writable stream.
writable.[1]('Hello, world!');
The write method sends data to the writable stream.
Fix the error in the code to properly close the writable stream after writing.
writable.write('Data'); writable.[1]();
The end method signals that no more data will be written and closes the stream properly.
Fill both blanks to create a writable stream and write 'Test' to it.
import { [1] } from 'fs'; const stream = [2]('test.txt'); stream.write('Test');
Both blanks require createWriteStream to import and create the writable stream.
Fill all three blanks to write 'Hello' to a file and close the stream properly.
import { [1] } from 'fs'; const ws = [2]('hello.txt'); ws.[3]('Hello'); ws.end();
Use createWriteStream to import and create the stream, and write to send data.