This function writes a chunk of data to an open file stream. It requires that the file
stream is already opened, and if the stream does not exist, an error is thrown.
This ensures that the file stream is explicitly managed, avoiding resource leaks.
After writing the data, an event is emitted using the event handler configured with
the event name specified in config.writeEventName. This allows other parts of the
application to react to file writes in a decoupled manner.
Throws
Thrown if the environment is not a Node.js server.
Throws
Thrown if the file stream to write to does not exist.
Throws
Thrown if any unexpected error occurs while writing to the file stream.
writeFileStream(filePath, chunk): boolean
Parameters
filePath: string
Path to the file where the data will be written.
chunk: string
The data to write to the file.
Returns boolean
Returns true if the data was successfully written, false if it was buffered.
Writes data to a file stream.
This function writes a chunk of data to an open file stream. It requires that the file stream is already opened, and if the stream does not exist, an error is thrown. This ensures that the file stream is explicitly managed, avoiding resource leaks.
After writing the data, an event is emitted using the event handler configured with the event name specified in
config.writeEventName
. This allows other parts of the application to react to file writes in a decoupled manner.Throws
Thrown if the environment is not a Node.js server.
Throws
Thrown if the file stream to write to does not exist.
Throws
Thrown if any unexpected error occurs while writing to the file stream.