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: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:
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.
Quick reference
| Operation | Code |
|---|---|
| Read file content | content = await file.get_content(ctx) |
| Create from bytes | await File.from_bytes(ctx, data=b"...", name="file.txt") |
| Create from text | await File.from_bytes(ctx, data=text.encode("utf-8"), name="out.txt", content_type="text/plain") |
| Access file name | file.name |
| Access content type | file.content_type |
| Access file URI | file.uri |
| File type input | TypeDefinition(data_type=DataType.File) |
| File list input | TypeDefinition(data_type=DataType.File, is_list=True) |
| Image type input | TypeDefinition(data_type=DataType.Image) |
Handling multiple files
Use list types to receive or produce multiple files:Next: Advanced Techniques →
Config UI controls, dynamic config, list handling, error handling, and deployment.