Treatment writeText

fs/util::writeText


Parameters

↳ var append: bool = false
↳ var create: bool = true
↳ var new: bool = false
↳ var path: string

Inputs

⇥ text: Stream<string>

Outputs

↦ amount: Stream<u128>
↦ error: Stream<string>
↦ failure: Block<void>
↦ success: Block<void>


Write text in one file.

The text received through text is written as UTF-8 in the file located at path. The writing behavior is set up by the parameters:

  • append: bytes are added to the file instead of replacing the existing file;
  • create: if the file does not exists, it is created;
  • new: the file is required to being new, if a file already exists at that path then the writing fails.

The amount of written bytes is sent through amount. There is no guarantee about its increment, as an undefined number of bytes may be written at once. success is emitted when successful writting is finished. failure is emitted if an error occurs, and error contains the related text of error(s).