@turbowarp/sb3fix 0.1.0 → 0.1.1
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 +10 -4
- package/package.json +1 -1
- package/src/sb3fix.js +1 -1
package/README.md
CHANGED
|
@@ -22,11 +22,17 @@ const run = async () => {
|
|
|
22
22
|
const projectData = fs.readFileSync('your-broken-project.sb3');
|
|
23
23
|
const result = await sb3fix(projectData); // projectData can be ArrayBuffer, Uint8Array-like, Blob, or File
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
const log = result.log; // log is Array of strings
|
|
25
|
+
console.log(result);
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const success = result.success; // success is boolean
|
|
28
|
+
if (success) {
|
|
29
|
+
const fixedZip = result.fixedZip; // fixedZip is ArrayBuffer
|
|
30
|
+
const log = result.log; // log is Array of strings
|
|
31
|
+
} else {
|
|
32
|
+
const error = result.error; // error is any type (probably an Error, but not necessarily)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// sb3fix is deterministic: the same input project always produces the same output
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
run();
|
package/package.json
CHANGED
package/src/sb3fix.js
CHANGED
|
@@ -43,7 +43,7 @@ const BUILTIN_EXTENSIONS = [
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* @param {ArrayBuffer|Uint8Array|Blob} data
|
|
46
|
-
* @returns {Promise<{log: string[]
|
|
46
|
+
* @returns {Promise<{success: boolean; fixedZip: ArrayBuffer; log: string[]; error?: unknown;}>} fixed compressed sb3
|
|
47
47
|
*/
|
|
48
48
|
const sb3fix = async (data) => {
|
|
49
49
|
const logMessages = [];
|