Skip to content

Commit

Permalink
Fixed sync function to create file on sync
Browse files Browse the repository at this point in the history
  • Loading branch information
terryluan12 committed Jun 25, 2024
1 parent 2ab5a6e commit 3e1614d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/backends/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ export class UnlockedOverlayFS extends FileSystem {
public async sync(path: string, data: Uint8Array, stats: Readonly<Stats>): Promise<void> {
const cred = stats.cred(0, 0);
await this.createParentDirectories(path, cred);
const fileExists = await this._writable.exists(path, cred);
if (!fileExists) {
await this._writable.createFile(path, 'w', 0o644, cred);
}
await this._writable.sync(path, data, stats);
}

Expand Down

0 comments on commit 3e1614d

Please sign in to comment.