Storage Nodes
> Upload files to Brickr's cloud storage from your routes.
Brickr provides a single storage node for uploading files. It requires a sequence connection because it performs an external operation.
Uploading Files
upload-file-to-storage
Uploads a file to Brickr's cloud storage and returns the public URL.
| Pin | Direction | Type | |-----|-----------|------| | sequence in | Input | sequence | | file | Input | object | | path | Input | string | | url | Output | string | | success | Output | boolean | | sequence out | Output | sequence |
The file input accepts a file object, typically obtained from the request body when a client sends a multipart form upload. The path input specifies where in storage the file should be saved (e.g., uploads/images/photo.png).
Organize files using path prefixes like folders. For example, use avatars/{userId}/profile.png to keep user files separated. While storage is flat (no actual folders), path prefixes help you organize and list files logically.
This is currently the only storage node available. File retrieval, listing, and deletion are not yet supported as dedicated nodes. You can use the returned URL to reference uploaded files.
Common Pattern
Accepting file uploads
1. Create a POST route that accepts multipart form data. 2. Use get-body to read the uploaded file data from the request. 3. Use upload-file-to-storage to save it to cloud storage. 4. Use return-json to return the file URL to the client.