Skip to content

Commit 2fca108

Browse files
committed
overwrite a file if it exists in emscripten_async_wget2 #3469
1 parent 4c0c6f1 commit 2fca108

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/library_browser.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,10 @@ mergeInto(LibraryManager.library, {
853853
// LOAD
854854
http.onload = function http_onload(e) {
855855
if (http.status == 200) {
856+
// if a file exists there, we overwrite it
857+
try {
858+
FS.unlink(_file);
859+
} catch (e) {}
856860
FS.createDataFile( _file.substr(0, index), _file.substr(index + 1), new Uint8Array(http.response), true, true);
857861
if (onload) {
858862
var stack = Runtime.stackSave();

0 commit comments

Comments
 (0)