Skip to content

Commit

Permalink
Removed src and tsconfig.json from package
Browse files Browse the repository at this point in the history
Added support for partial stats updating
  • Loading branch information
james-pre committed Nov 30, 2024
1 parent b7809bb commit 403c4c2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
},
"files": [
"dist",
"src",
"license.md",
"tsconfig.json"
"license.md"
],
"engines": {
"node": ">= 18"
Expand Down Expand Up @@ -56,7 +54,7 @@
"typescript-eslint": "^8.8.1"
},
"peerDependencies": {
"@zenfs/core": "^1.1.0"
"@zenfs/core": "^1.3.0"
},
"dependencies": {
"utilium": ">=0.4.0"
Expand Down
14 changes: 5 additions & 9 deletions src/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function convertError(e: unknown, path: string = ''): ErrnoError {
return new ErrnoError(errno, errorMessages[errno], paths.length > 0 ? '/' + paths.join('/') : path);
}

export class EmscriptenFile extends File {
export class EmscriptenFile extends File<EmscriptenFS> {
public constructor(
public fs: EmscriptenFS,
protected em: typeof FS,
Expand Down Expand Up @@ -171,10 +171,10 @@ export class EmscriptenFS extends Sync(FileSystem) {
};
}

public syncSync(path: string, data: Uint8Array, stats: Readonly<Stats>): void {
public syncSync(path: string, data?: Uint8Array, stats: Readonly<Partial<Stats>> = {}): void {
try {
this.em.writeFile(path, data);
this.em.chmod(path, stats.mode);
if (data) this.em.writeFile(path, data);
if (stats.mode) this.em.chmod(path, stats.mode);
} catch (e) {
throw convertError(e, path);
}
Expand Down Expand Up @@ -331,11 +331,7 @@ const _Emscripten = {
name: 'Emscripten',

options: {
FS: {
type: 'object',
required: true,
description: 'The Emscripten file system to use (the `FS` variable)',
},
FS: { type: 'object', required: true },
},

isAvailable(): boolean {
Expand Down

0 comments on commit 403c4c2

Please sign in to comment.