Blob Converter
Converts input Blob(s) or File(s) into a specified format (data URL, ArrayBuffer, or text), with support for batch processing, error handling modes, and runtime configuration.
In-ports
input <Object|Array|Blob>
— Batch Blob conversion request (see Batch request), single Blob or array of Blobs.
config <JSON>
(dynamic) — Accepts a JSON object with configuration properties (maxBlobSize
, outputFormat
, batchMode
) that can be set at runtime. This port is available if "Enable realtime config port" is enabled in settings. When enabled, static settings are ignored and all configuration must be provided via this port.
Out-ports
output <Object>
— The result object has the following structure:
errors <Object>
— Only used in all-or-nothing
mode when a conversion error occurs. Emits the same result structure as above.
Overview
The Blob Converter component converts one or more Blob/File objects into a specified format for downstream processing:
- Data URL for embedding or previewing
- ArrayBuffer for binary or base64 encoding
- Text for text or JSON files
- Includes metadata such as name and format
- Supports processing in batch
If the input blob exceeds the configured maximum size, the component emits an error (see Error Handling and Modes).
Error Handling and Modes
- If a conversion error occurs:
- all-or-nothing: The output port emits an error signal (with the result object), and the error port receives the result object as well.
- best-effort: The output port emits the result object (with error details in the corresponding item), and the error port is not used.
- If all conversions succeed:
- Both modes emit the result object on the output port; the error port is not used.
- If the input request is invalid (see Batch request for details), the component emits a
CUSTOM_ERROR
signal with code 400 or 500.
Batch request
Send a batch request to input port to convert multiple Blobs. The request has following fields:
batch
: Array of Blob/File objects.context
: (optional) Arbitrary value, passed through to the output as-isbatchMode
: (optional) Overrides the current batch mode for this requestoutputFormat
: (optional) Overrides the current output format for this request
Example output result
{
data: [
{
size: number, // Input blob size in bytes
name: string, // File name (from Blob/File)
format: string, // Output format: 'dataurl', 'arraybuffer', or 'text'
result: any, // Converted data (type depends on format)
error?: Error, // Present if conversion failed
message?: string // Present if conversion failed
},
...
],
meta: {
settings: {
outputFormat: string, // Effective output format
batchMode: string, // Effective batch mode
maxBlobSize: string // Effective max blob size
},
request: { ... } // Original input object (with unconverted blobs)
}
}
Settings
Enable realtime config port
If this setting is enabled, the component can be configured through the config port. This port accepts a configuration object as input and allows you to set dynamic properties at runtime. When enabled, static settings are ignored and all configuration must be provided via the config port. Note that using this port does not cause the component to reinitialize, but it may cause some previous state of the component to be lost.
Max blob size (maxBlobSize
)
Maximum allowed blob size. Type: string
(e.g., '5MB', '1000000'). Default: '5MB'
.
Why is this needed? When converting a blob to a data URL, the entire blob must be loaded into memory. Limiting the maximum blob size helps prevent excessive memory allocation, which could otherwise cause the app to run out of memory or crash at runtime.
Output format (outputFormat
)
The format to convert each blob to. One of:
'dataurl'
(default)'arraybuffer'
'text'
Batch mode (batchMode
)
Controls error handling for batch conversions. One of:
'all-or-nothing'
(default): If any conversion fails, the output is an error signal (output and error ports), and no successful results are emitted.'best-effort'
: Each conversion result is included in the output array, with errors present only for failed items. No error signal is emitted; the error port is not used.
Note: Settings can be overridden per-request by including
batchMode
oroutputFormat
in the input object. If the realtime config port is enabled, settings must be provided via the config port and are not propagated from static settings.