File

Allows you to upload a file to Airplane.
Airplane's SDKs make it easy to interact with files from your tasks and views.
To learn more about using files in Airplane, see Files documentation.

Upload

Create a file that can be passed to other tasks as a file parameter, rendered as a file display, or returned as task output.
typescript
Copied
1
const resp = await fetch("https://airplane.dev");
2
3
const myFile = airplane.file.upload(await resp.text(), "airplane.txt");
4
5
// you can display the file directly in the UI
6
await airplane.display.file(myFile);
7
8
// you can also pass the file to another task
9
await airplane.execute("my_task", { file: myFile });
airplane.file.upload(payload, fileName)
payload
REQUIRED
Blob or string

Content of the file to upload.

fileName
optional
string

Name of the file to create. If not provided, the filename will be generated by trying to infer the file type from the payload. If the file type cannot be inferred, an error will be raised.