Skip to content

GramIO API Reference / @gramio/files/dist / FileSource

Type Alias: FileSource

FileSource = "auto" | "url" | "disk" | "rewrite" | ((file) => Promise<ArrayBuffer> | ArrayBuffer)

Defined in: files/index.d.ts:216

Strategy for how downloadFile obtains file bytes — mainly relevant with a local Bot API server (--local), where getFile returns an absolute path on the server's disk instead of a URL.

  • "auto" (default) — absolute file_pathbaseURL rewrite if set, else read from disk; relative file_path → classic download URL.
  • "url" — classic <baseURL>/file/bot<token>/<path> download.
  • "disk" — read the absolute file_path straight from the local filesystem.
  • "rewrite" — fetch ${files.baseURL}/<relative path> over HTTP (token-less).
  • a function — full custom resolution.