Write file
  • 18 May 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

Write file

  • Dark
    Light
  • PDF

Article Summary

Writes data to a target file. You can set the encoding and whether or not the data should be appended to the end, or the whole file overwritten.

Input arguments

LabelKeyTypeRequired?DefaultDescription
Target file pathpathString(local-filesystem-reference)YesAbsolute local filesystem path to the target file.
Data to writedataStringYesData to write into the target file.
File encodingencodingStringYesutf8Encoding with which to write into the target file.
Overwrite file?overwriteBooleanYestrueIf true, overwrite the target file. If false, data is appended to the end of the target file.

Output arguments

Number of outputs: 2

LabelKeyTypeDescription
FilefileObjectObject representing the written file.
  • Local path
file.pathStringAbsolute local filesystem path representing the file location on the device, including the filename and extension. On web, this is created via the [`createObjectURL`](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) method.
  • MIME type
file.mimeTypeStringMIME type of the file, if it could be determined.
  • Name
file.nameStringName of the file in the local filesystem, if applicable. Note that the filename and extension are included in the **Local path** property already.
  • Size
file.sizeNumberSize of the file, in bytes.
  • Created at
file.createdAtStringCreation datetime of the file, if it can be determined.
  • Modified at
file.modifiedAtStringDatetime when the file was last modified, if it can be determined.

Events

No events.

Errors

LabelCodeDescription
Unkown errorunknownThrown if an unknown error occured while writing the file.

Was this article helpful?