HTTP API_file - gd-99/symbiogd GitHub Wiki

The module file manages files.

Actions

getContents

Get a file's contents.

Permission required: file.read

If the specified file is a directory, its content is returned as an object associating file paths to their metadata. Otherwise, the file's contents is returned via stdout (standard output).

Errors:

  • 404: file not found.

getAsBinary

Get a file's contents, encoded in base64.

See getContents for permissions, returned data and errors.

getMinified

Get a file's contents, minified.

This action is deprecated. Do not use!

getData

Get a file's metadata.

Permission required: file.read

Returned data: the file's metadata.

Errors:

  • 404: file not found.

Data models

file

  • path: the file path (e.g. ~/Desktop/myfile.txt)
  • basename: the file basename (e.g. myfile.txt)
  • realpath: the file direct path, relative to the current browser location (e.g. home/demo/Desktop/myfile.txt)
  • download_url: the file download URL
  • dirname: the file dirname (e.g. ~/Desktop)
  • Number atime: the file's last acces timestamp
  • Number mtime: the file's last modification timestamp
  • Number size: the file's size. If it's a directory, the number of contained files, otherwise the file's size in bytes.
  • Boolean is_dir: true if the file is a directory, false otherwise

If the file is not a directory:

  • mime_type: the file's MIME type
  • ...