Treatment write



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


⇥ data: Stream<byte>


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

Write one file.

The bytes received through data are written 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. finished is emitted when successful writting is finished. failure is emitted if an error occurs, and error contains the related text of error(s).