
  -spec write(IoDevice, Bytes) -> ok | {error, Reason}
                 when
                     IoDevice :: io_device() | atom(),
                     Bytes :: iodata(),
                     Reason :: posix() | badarg | terminated.

  Writes Bytes to the file referenced by IoDevice. This function
  is the only way to write to a file opened in raw mode (although
  it works for normally opened files too). Returns ok if
  successful, and {error, Reason} otherwise.

  If the file is opened with encoding set to something else than 
  latin1, each byte written can result in many bytes being written
  to the file, as the byte range 0..255 can represent anything
  between one and four bytes depending on value and UTF encoding
  type.

  Typical error reasons:

  ebadf:
    The file is not opened for writing.

  enospc:
    No space is left on the device.
