Skip to content

Commit b0aa56d

Browse files
committed
Fix Failed to execute 'getWriter' on 'WritableStream': Cannot create writer when WritableStream is locked error
1 parent d337f26 commit b0aa56d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/uartUploadZIP.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@
8686
// If the path ends with a slash, it's a directory, which we should create if it doesn't exist
8787
if (path[path.length-1]=="/") {
8888
console.log("Creating directory "+path);
89-
UART.getConnection().write(`\x10if (!require("fs").statSync(${JSON.stringify(path)})) require("fs").mkdir(${JSON.stringify(path)});\n`);
89+
return new Promise(resolve =>
90+
UART.getConnection().write(`\x10if (!require("fs").statSync(${JSON.stringify(path)})) require("fs").mkdir(${JSON.stringify(path)});\n`, resolve));
9091
} else {
9192
console.log("Can't restore files of length 0, ignoring "+path);
9293
}

0 commit comments

Comments
 (0)