This is part 5 of the Your First Plugin tutorial. Make sure you’ve completed 4. Use Integration in Node first.
Reading files
Add a node that reads a file input: AFile flows through a V2 node like any other value: declare a bindable
File config field to receive one, and a File-typed output field to emit one.
How file reading works
When aFile type input arrives, it contains metadata (name, URI, content type) but not the actual bytes. Calling file.get_content(ctx) triggers:
Your plugin runs inside a sandbox with no direct access to platform storage, so the SDK asks the platform for the bytes over the same channel the platform used to call your node. The platform only serves files belonging to the workspace the run is executing for — a plugin cannot reach another workspace’s files.
You can also access file metadata without downloading:
Creating files
File.from_bytes() uploads the content to the platform’s storage and returns a File object that downstream nodes can use. File.from_bytes_internal_uri() is an alias with a self-documenting name — reach for it at explicit persistence sites (e.g. saving a downloaded attachment) when you want the call to read clearly.
Giving a library real file paths
Some libraries need a real path on disk rather than aFile reference. Download
inputs into the sandbox’s local filesystem with persist_files_locally:
/tmp); it is not platform storage. To hand results back to the flow, upload
them again with File.from_bytes.
Quick reference
data, name, and content_type are positional/keyword on File.from_bytes(ctx, data, name=..., content_type=...) — data is the first argument after ctx, not a keyword-only field. (On a V1 node these are declared instead with TypeDefinition(data_type=DataType.File) connectors.)Handling multiple files
Use alist[File] field to receive or produce multiple files. On a V2 node it’s
a bindable list[File] config field (input) and/or a list[File] output field:
Parsing email
If your node receives raw email bytes, the SDK’sEmail helper parses an
RFC-822 message into a typed model whose attachments and inline images are
persisted to platform storage as Files — over the same host callbacks, so it
never needs network access back to the platform:
zip_attachments=True to Email.from_email_object to collapse all
attachments into a single attachments.zip file instead of one File per part.
Next: Advanced Techniques →
Config UI controls, dynamic config, list handling, error handling, and deployment.