@ai-sdk/provider-utils 5.0.35 → 5.0.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/provider-utils",
3
- "version": "5.0.35",
3
+ "version": "5.0.37",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -32,11 +32,11 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
- "@ai-sdk/provider": "4.0.10",
35
+ "@ai-sdk/provider": "4.0.11",
36
36
  "@standard-schema/spec": "^1.1.0",
37
37
  "@workflow/serde": "4.1.0",
38
38
  "eventsource-parser": "^3.0.8",
39
- "undici": "^7.28.0"
39
+ "undici": "^7.29.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "22.19.19",
@@ -10,15 +10,16 @@ export function convertBase64ToUint8Array(base64String: string) {
10
10
  }
11
11
 
12
12
  export function convertUint8ArrayToBase64(array: Uint8Array): string {
13
- let latin1string = '';
13
+ const chunks: string[] = [];
14
+ const chunkSize = 4096;
14
15
 
15
16
  // Note: regular for loop to support older JavaScript versions that
16
17
  // do not support for..of on Uint8Array
17
- for (let i = 0; i < array.length; i++) {
18
- latin1string += String.fromCodePoint(array[i]);
18
+ for (let i = 0; i < array.length; i += chunkSize) {
19
+ chunks.push(String.fromCodePoint(...array.subarray(i, i + chunkSize)));
19
20
  }
20
21
 
21
- return btoa(latin1string);
22
+ return btoa(chunks.join(''));
22
23
  }
23
24
 
24
25
  export function convertToBase64(value: string | Uint8Array): string {