@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 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
- const fixedZip = result.fixedZip; // fixedZip is ArrayBuffer
26
- const log = result.log; // log is Array of strings
25
+ console.log(result);
27
26
 
28
- // sb3fix is deterministic: the same input project always produces the same zip and log
29
- // If the zip cannot be fixed, the Promise returned by sb3fix() will reject. You should handle this.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turbowarp/sb3fix",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Fix corrupted Scratch projects",
5
5
  "main": "src/sb3fix.js",
6
6
  "scripts": {
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[], fixedZip: ArrayBuffer}>} fixed compressed sb3
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 = [];