Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.js.map

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions esm/interpreter/_nativefs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { mkdirTree } from './_utils.js';

async function syncfs(FS, direction) {
return new Promise((resolve, reject) => {
FS.syncfs(direction, err => {
if (err) reject(err);
else resolve();
});
});
}

// (C) Pyodide https://github.com/pyodide/pyodide - Mozilla Public License Version 2.0
// JS port of https://github.com/pyodide/pyodide/blob/34fcd02172895d75db369994011409324f9e3cce/src/js/nativefs.ts
export function initializeNativeFS(module) {
Expand Down Expand Up @@ -265,13 +274,13 @@ export function initializeNativeFS(module) {
{ fileSystemHandle },
path,
);

// sync native ==> browser
await new Promise($ => FS.syncfs(true, $));
await syncfs(FS, true);

return {
// sync browser ==> native
syncfs: () => new Promise($ => FS.syncfs(false, $)),
syncfs: async () => await syncfs(FS, false),
};
};
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@
"to-json-callback": "^0.1.1"
},
"worker": {
"blob": "sha256-0wd916BW20JpkmHfpwIyLYYvtV2iGIgaef2TXDirEao="
"blob": "sha256-62NQHNKhtPYl3hwHE08fYFF4F1HihbBJD0y8Xw25frA="
}
}