FILE STORAGES
Thinger.io provides a flexible cloud storage system that allows uploading files to the IoT server in order to provide support to other platform features, such as the HTML Widget or the OTA System. The information will be stored in a non-volatile memory of the server host.
Note that this feature is only available for private instances, as it requires a cloud storage system.
File Storages
File Storages provide a flexible file management system for storing and serving files within the platform. You can use storages for hosting static websites, storing firmware files, managing custom assets, exporting data, and more.
To manage your storages, navigate to Storages in the console.
Creating a Storage
Click Add Storage to create a new storage. The configuration includes:
Basic Information
Storage ID: A unique identifier for the storage (alphanumeric and underscores, max 25 characters). This ID is used in URLs and API calls.
Storage Name: A display name for the storage.
Storage Description: Optional description for administrative purposes (max 255 characters).
Access Configuration
Public Read: Enable to allow public access to files without authentication. When disabled, all file access requires authentication or a valid access token.
Index File: The default file served when accessing the storage root URL (e.g.,
index.html). Useful for hosting static websites.
Terminal Configuration
Terminal Image: A Docker image to use for the integrated terminal environment (e.g.,
alpine:latest,python:3.12-alpine). This allows running shell commands directly within the storage context.
HTTP Access
Once created, your storage is accessible via HTTP at:
For public storages, files can be accessed directly without authentication. For private storages, include an authorization header or access token.
File Explorer
The File Explorer provides a modern interface for managing files within your storage, similar to VS Code's file browser.
Navigation
Tree View: Browse your file structure in a collapsible tree on the left panel
Breadcrumbs: Navigate using the path breadcrumbs at the top
Lazy Loading: Large directories load content on demand for better performance
File Operations
Uploading Files
Click the Upload button in the toolbar
Select one or multiple files from your computer
Monitor the upload progress
Files appear in the tree once uploaded
You can also drag and drop files directly into the file explorer.
Creating Files and Folders
New File: Click the new file icon or use the context menu to create an empty file
New Folder: Click the new folder icon or use the context menu to create a directory
Managing Files
Rename: Right-click a file or folder and select Rename, or use the context menu
Delete: Right-click and select Delete, or select files and use the delete button
Download: Click the download button or right-click and select Download
Move: Drag and drop files between folders
Code Editor
The integrated Monaco editor (the same editor used in VS Code) provides a rich editing experience for text files:
Syntax Highlighting: Automatic language detection based on file extension
Multiple Files: Open multiple files in tabs
Unsaved Changes: Visual indicator for files with unsaved changes
Find & Replace: Full text search within files
Supported file types include JavaScript, TypeScript, Python, HTML, CSS, JSON, YAML, Markdown, and many more.
File Preview
The explorer includes built-in preview support for various file types:
Images: PNG, JPG, GIF, SVG rendered natively
PDFs: Integrated PDF viewer
Videos: Built-in video player
Text/Code: Displayed in the Monaco editor
Other: File metadata and information panel
VS Code Integration
For a full IDE experience, access the VS Code integration:
Navigate to your storage
Click VS Code in the storage menu
A full VS Code environment opens with your storage mounted
The storage is mounted at /home/coder/storages/{storage_id} within the VS Code environment.
Terminal Access
The integrated terminal allows running shell commands directly within your storage context:
Ensure a Terminal Image is configured in storage settings
Open the terminal panel in the File Explorer
The terminal connects via WebSocket to a container running your specified image
Execute commands with direct access to your storage files
Common use cases:
Running build scripts
Installing dependencies
Processing files with command-line tools
Git operations
Common Use Cases
Hosting Static Websites
Create a storage with Public Read enabled
Set Index File to
index.htmlUpload your HTML, CSS, JavaScript, and asset files
Access your site at the storage URL
Firmware Storage
Store device firmware files for OTA updates:
Create a storage for firmware files
Organize by device type or version (e.g.,
/firmware/v1.0.0/device.bin)Devices can download firmware via the storage URL
Use access tokens for secure, authenticated downloads
Data Exports
Export data from buckets to file storage:
Configure bucket export to target a storage
Exported files (CSV, JSON) are saved to the storage
Download or process exported data as needed
Custom Dashboard Widgets
Host custom HTML widgets for dashboards:
Create HTML/JavaScript widget files
Upload to a storage with Public Read enabled
Reference the file URL in dashboard HTML widgets
Email Templates
Store custom email templates:
Create HTML email templates
Upload to a storage
Reference in notification configurations
Integration Examples
File Storages can be accessed programmatically via the REST API, enabling integration with external systems, scripts, and devices. All examples use the v2 API endpoints.
Authentication
All requests to private storages require a Bearer token:
Public storages (with Public Read enabled) allow GET requests without authentication.
Listing Files
List contents of a directory:
List including hidden files:
List recursively (all subdirectories):
Downloading Files
Download a file:
For public storages, no authorization is needed:
Uploading Files
Upload a binary file (e.g., firmware):
Upload a text file:
Upload without overwriting existing files (returns 409 if file exists):
Upload with progress indicator (useful for large files):
Creating Directories
Create a directory (note the trailing slash):
Create nested directories:
Deleting Files
Delete a file:
Delete a directory and its contents:
Renaming and Moving Files
Rename a file:
Move a file to a different directory:
Getting File Information
Get metadata about a file without downloading it:
Response:
Device Integration Example
A typical IoT device firmware update flow:
Access Control
Permissions
File Storages use fine-grained permissions:
ReadStorageFiles
List, read, and download files
UpdateStorageFiles
Upload files and create directories
DeleteStorageFiles
Delete files and directories
RenameStorageFiles
Rename and move files
AccessStorageTerminal
Access the integrated terminal
Access Tokens
Create access tokens with limited permissions for external access:
Navigate to the storage settings
Create an access token with specific permissions (e.g., read-only)
Use the token in API requests or share for limited access
This is useful for:
Providing read-only access to firmware downloads
Allowing external services to upload files
Sharing files without exposing full account credentials
Best Practices
Use descriptive storage IDs - Choose meaningful names like
firmware,website,exportsrather than generic namesOrganize with directories - Structure files in logical folders for easier management
Set appropriate access levels - Only enable public read when necessary
Use access tokens - Create scoped tokens instead of sharing account credentials
Configure index files - For web-accessible storages, set an index file for cleaner URLs
Monitor storage usage - Keep track of storage consumption, especially for large files
Last updated