Module jls.io.streams.FileStreamHandler

Provide a simple file stream handler.

Class FileStreamHandler

FileStreamHandler:new (file[, overwrite[, onClose[, openOnData]]]) Creates a StreamHandler that will write to a file.
FileStreamHandler.readAll (file, stream[, size]) Reads the specified file using the stream handler.
FileStreamHandler.readAllSync (file, stream[, size]) Reads synchronously the specified file using the stream handler.


Class FileStreamHandler

This class allows to write a stream into and from a file.
FileStreamHandler:new (file[, overwrite[, onClose[, openOnData]]])
Creates a StreamHandler that will write to a file.

Parameters:

  • file jls.io.File The file to create
  • overwrite boolean true to indicate that existing file must be re created (optional)
  • onClose function a function that will be called when the stream has ended (optional)
  • openOnData boolean true to indicate that the file shall be opened on first data received (optional)
FileStreamHandler.readAll (file, stream[, size])
Reads the specified file using the stream handler.

Parameters:

  • file The file to read.
  • stream The stream handler to use with the file content.
  • size number The read block size, default is 1024. (optional)

Returns:

    a promise that resolves once the file has been fully read.
FileStreamHandler.readAllSync (file, stream[, size])
Reads synchronously the specified file using the stream handler.

Parameters:

  • file The file to read.
  • stream The stream handler to use with the file content.
  • size number The read block size, default is 1024. (optional)
generated by LDoc 1.4.6 Last updated 2022-01-22 16:32:56