Skip to content

Commit

Permalink
do the same for writeFile
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgrammerIn-wonderland committed Nov 10, 2024
1 parent 281f1fd commit b66f4ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/api/LocalFS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,17 +364,21 @@ class LocalFS extends AFSProvider<LocalFSStats> {
}
path = this.relativizePath(path);

const [handle, realPath] = await this.getFileHandle(path, {
// eslint-disable-next-line prefer-const
let [handle, realPath] = await this.getFileHandle(path, {
create: true,
});

const writer = await handle.createWritable();
if (realPath.startsWith("/")) {
realPath = realPath.slice(1);
}
const fileStats = this.stats.get(realPath) || {};

if (fileStats && !realPath.startsWith("foreign:")) {
fileStats.mtimeMs = Date.now();
fileStats.ctimeMs = Date.now();
this.stats.set(path, fileStats);
this.stats.set(realPath, fileStats);
}
writer.write(data);
writer.close();
Expand Down

0 comments on commit b66f4ae

Please sign in to comment.