@truto/truto-jsonata 1.0.23 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2133,6 +2133,55 @@ expression.evaluate({}).then(result => { console.log(result); });
2133
2133
 
2134
2134
  </details>
2135
2135
 
2136
+ <details>
2137
+ <summary>base64ToBlob(base64String, options = {})</summary>
2138
+
2139
+ Converts a Base64-encoded string to a Blob object.
2140
+
2141
+ **Parameters:**
2142
+
2143
+ - **base64String**: The Base64 string to convert. Can include data URI prefixes (e.g., `data:image/png;base64,iVBORw0...`)
2144
+ - **options** _(Optional)_: An object containing:
2145
+ - **mimeType**: The MIME type for the resulting Blob (default: `'application/octet-stream'`)
2146
+ - **urlSafe**: Whether to handle URL-safe Base64 encoding (default: `false`)
2147
+
2148
+ **Features:**
2149
+
2150
+ - Handles data URI format automatically
2151
+ - Supports URL-safe Base64 encoding
2152
+ - Automatic padding correction
2153
+ - Comprehensive error handling for invalid Base64 strings
2154
+ - MIME type detection from data URI or custom specification
2155
+
2156
+ **Example:**
2157
+
2158
+ ```javascript
2159
+ import trutoJsonata from '@truto/truto-jsonata';
2160
+
2161
+ // Basic usage
2162
+ const expression1 = trutoJsonata("$base64ToBlob('SGVsbG8gd29ybGQ=', { mimeType: 'text/plain' })");
2163
+ expression1.evaluate({}).then(result => {
2164
+ console.log(result);
2165
+ // Output: Blob object with type 'text/plain' and size 11
2166
+ });
2167
+
2168
+ // Data URI format
2169
+ const expression2 = trutoJsonata("$base64ToBlob('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg==')");
2170
+ expression2.evaluate({}).then(result => {
2171
+ console.log(result);
2172
+ // Output: Blob object with type 'image/png' (auto-detected from data URI)
2173
+ });
2174
+
2175
+ // URL-safe Base64
2176
+ const expression3 = trutoJsonata("$base64ToBlob('aHR0cHM6Ly9leGFtcGxlLmNvbS8_cXVlcnk9YmFzZTY0', { urlSafe: true })");
2177
+ expression3.evaluate({}).then(result => {
2178
+ console.log(result);
2179
+ // Output: Blob object containing the decoded data
2180
+ });
2181
+ ```
2182
+
2183
+ </details>
2184
+
2136
2185
 
2137
2186
 
2138
2187
  <details>