Skip to main content

Read File

Reads a file an earlier step produced into one value—its text, its JSON, or its bytes as Base64—so its contents can be used by later steps like any other value. The file itself stays in storage; only the one reading this step makes travels through the run.

You don't need this step to pass a file along or link to it. A file is already a value in the run—its Public URL, Content Type, and name are in the variable picker wherever the file is—so an image uploaded to a trigger can go straight into a Slack message or an HTTP upload. Read File is for getting at what a text file says.

A file reaches a run in two ways: a trigger whose payload has a file field—an On Demand trigger whose payload is a content type with a file, for instance—or an HTTP Request whose response was streamed to storage and appears as Body (File). Either shows in the variable picker as a file, with its filename and content type.

Fields

FieldDescription
FileThe file to read. Bind a file from an earlier step; the field takes a reference, not typed text, and its picker offers only the files earlier steps produce.
Read AsWhat to read the file into. Text decodes a text file. JSON parses a JSON file, failing the step if it doesn't parse. Base64 outputs any file's bytes as Base64, for an API that takes a file inline. One reading per step: each is the whole file in another encoding, stored with the run, so a step never produces more than one. Text when left unset.
Max Size and its UnitUnder Advanced. A file larger than this fails the step rather than being read into memory. 1 MB when left blank.

What later steps see

OutputDescription
Text, JSON, or Base64The one reading Read As chose, and the only one of the three the step declares. Text is decoded using the charset the content type names, or UTF-8 when it names none.
Content TypeThe file's content type.
Size (bytes)How many bytes were read. Absent when the file was described rather than read.
File NameThe name the file was uploaded under when that was recorded, else the last part of its path.

Behaviour

Text and JSON read a file whose type is text-like—text/*, or an application/* type naming JSON, XML, JavaScript, YAML, CSV or form data—or unknown, as a file added by URL usually is. A file whose type says it is something else—an image, a PDF—is described rather than decoded: the step completes with Content Type and File Name, no reading, and a line in its log saying so, because bytes that were declared to be something other than text have no useful form as a value. Base64 takes any file within Max Size. PDF and document extraction are not what this step does.

The size cap is enforced while reading. A file over the cap is not buffered and then rejected; the read stops at the cap and the step fails naming the limit, so a large file bound by mistake cannot cost the server its memory.

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.