@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/CHANGELOG.md +16 -0
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/uint8-utils.ts +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/provider-utils",
|
|
3
|
-
"version": "5.0.
|
|
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.
|
|
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.
|
|
39
|
+
"undici": "^7.29.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "22.19.19",
|
package/src/uint8-utils.ts
CHANGED
|
@@ -10,15 +10,16 @@ export function convertBase64ToUint8Array(base64String: string) {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function convertUint8ArrayToBase64(array: Uint8Array): string {
|
|
13
|
-
|
|
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
|
-
|
|
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(
|
|
22
|
+
return btoa(chunks.join(''));
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export function convertToBase64(value: string | Uint8Array): string {
|