ChatiumFor developersPlaygroundPricing
Sign in

Class StorageFile

An object-oriented representation of a file in storage.

Example usage

import {StorageFile} from '@app/storage'
import {jsx} from '@app/html-jsx'

app.html('/', () => {
  const hash = 'image_du27eDoNiW.512x512.png'
  const file = new StorageFile(hash)
  return <html>
    <p>File {file.hash}</p>
    <p>Type: {file.type}</p>
    <a href={file.downloadUrl}>Download</a>
  </html>
})

Properties:

  • hash - The hash of the file.
  • type - The type of the file. It can be: file, image, video, audio
  • downloadUrl - A link to download the file. The file will be served with an HTTP header that forces the file to be downloaded instead of opening it in the browser window. There is no need to open the file in a new tab.