When the options.contentMode is set to 'utf8' when the stream is created, the data argument must be a string. If the contentMode is set to 'buffer', the data argument must be a Buffer.
options.contentMode
'utf8'
data
contentMode
'buffer'
Buffer
The data to write.