We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17377d2 commit d337f26Copy full SHA for d337f26
examples/uartUploadZIP.html
@@ -83,7 +83,13 @@
83
return file.async("binarystring");
84
}).then(data => {
85
if (data.length==0) {
86
- console.log("Can't restore files of length 0, ignoring "+path);
+ // If the path ends with a slash, it's a directory, which we should create if it doesn't exist
87
+ if (path[path.length-1]=="/") {
88
+ console.log("Creating directory "+path);
89
+ UART.getConnection().write(`\x10if (!require("fs").statSync(${JSON.stringify(path)})) require("fs").mkdir(${JSON.stringify(path)});\n`);
90
+ } else {
91
+ console.log("Can't restore files of length 0, ignoring "+path);
92
+ }
93
} else {
94
var crc = CRC32(data.substring(0,1024)); // CRC first kb
95
var existing = files.find(f => f.fn.toUpperCase()==path.toUpperCase());
0 commit comments