Appearance
hailer.file
Read and upload files in Hailer's own file storage, and manage file tags. (For calling external services, see http.)
| Method | Host op | Returns |
|---|---|---|
get(fileId) | file.get | Promise<FileResponse> |
upload(file, filename, options?) | file.upload | Promise<string> (file id) |
addTags(fileId, tags) | file.addTags | Promise<string[]> |
removeTags(fileId, tags) | file.removeTags | Promise<string[]> |
get(fileId)
ts
const file = await hailer.file.get(fileId);
// { filename, data (base64), mimeType, tags: string[] }upload(file, filename, options?)
ts
const fileId = await hailer.file.upload(file, 'photo.png', { isPublic: true });Takes a browser File. The SDK converts it to base64 before sending (binary can't cross the app↔host bridge directly). options.isPublic marks the file publicly accessible. Resolves with the new file id.
addTags(fileId, tags) / removeTags(fileId, tags)
ts
const tags = await hailer.file.addTags(fileId, ['invoice', '2026']);
await hailer.file.removeTags(fileId, ['2026']);Both return the file's resulting tag list.
- addTags — tags are trimmed; each must be 1–64 characters; a file holds at most 50 tags.
- removeTags — matching is case-sensitive and exact; tags that aren't present are ignored.