freestyle-sandboxes 0.0.72 → 0.0.74
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/dist/index.cjs +4 -2
- package/dist/index.mjs +4 -2
- package/package.json +1 -1
- package/src/index.ts +5 -3
package/dist/index.cjs
CHANGED
|
@@ -1000,7 +1000,7 @@ ${response.error.message}`);
|
|
|
1000
1000
|
return response2.data.content.content;
|
|
1001
1001
|
},
|
|
1002
1002
|
async writeFile(path, content, encoding = "utf-8") {
|
|
1003
|
-
const contentStr = typeof content === "string" ? content :
|
|
1003
|
+
const contentStr = typeof content === "string" ? content : Buffer.from(content).toString(encoding);
|
|
1004
1004
|
const response2 = await handleWriteFileFromEphemeralDevServer({
|
|
1005
1005
|
client,
|
|
1006
1006
|
path: {
|
|
@@ -1013,7 +1013,9 @@ ${response.error.message}`);
|
|
|
1013
1013
|
}
|
|
1014
1014
|
});
|
|
1015
1015
|
if (response2.error) {
|
|
1016
|
-
throw new Error(
|
|
1016
|
+
throw new Error(
|
|
1017
|
+
`Failed to write file: ${JSON.stringify(response2.error)}`
|
|
1018
|
+
);
|
|
1017
1019
|
}
|
|
1018
1020
|
}
|
|
1019
1021
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -998,7 +998,7 @@ ${response.error.message}`);
|
|
|
998
998
|
return response2.data.content.content;
|
|
999
999
|
},
|
|
1000
1000
|
async writeFile(path, content, encoding = "utf-8") {
|
|
1001
|
-
const contentStr = typeof content === "string" ? content :
|
|
1001
|
+
const contentStr = typeof content === "string" ? content : Buffer.from(content).toString(encoding);
|
|
1002
1002
|
const response2 = await handleWriteFileFromEphemeralDevServer({
|
|
1003
1003
|
client,
|
|
1004
1004
|
path: {
|
|
@@ -1011,7 +1011,9 @@ ${response.error.message}`);
|
|
|
1011
1011
|
}
|
|
1012
1012
|
});
|
|
1013
1013
|
if (response2.error) {
|
|
1014
|
-
throw new Error(
|
|
1014
|
+
throw new Error(
|
|
1015
|
+
`Failed to write file: ${JSON.stringify(response2.error)}`
|
|
1016
|
+
);
|
|
1015
1017
|
}
|
|
1016
1018
|
}
|
|
1017
1019
|
},
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1076,12 +1076,12 @@ export class FreestyleSandboxes {
|
|
|
1076
1076
|
async writeFile(
|
|
1077
1077
|
path: string,
|
|
1078
1078
|
content: string | ArrayBuffer,
|
|
1079
|
-
encoding = "utf-8"
|
|
1079
|
+
encoding: BufferEncoding = "utf-8"
|
|
1080
1080
|
) {
|
|
1081
1081
|
const contentStr =
|
|
1082
1082
|
typeof content === "string"
|
|
1083
1083
|
? content
|
|
1084
|
-
:
|
|
1084
|
+
: Buffer.from(content).toString(encoding);
|
|
1085
1085
|
|
|
1086
1086
|
const response =
|
|
1087
1087
|
await sandbox_openapi.handleWriteFileFromEphemeralDevServer({
|
|
@@ -1097,7 +1097,9 @@ export class FreestyleSandboxes {
|
|
|
1097
1097
|
});
|
|
1098
1098
|
|
|
1099
1099
|
if (response.error) {
|
|
1100
|
-
throw new Error(
|
|
1100
|
+
throw new Error(
|
|
1101
|
+
`Failed to write file: ${JSON.stringify(response.error)}`
|
|
1102
|
+
);
|
|
1101
1103
|
}
|
|
1102
1104
|
},
|
|
1103
1105
|
},
|