diff --git a/packages/fuse-client/syscalls/getattr.ts b/packages/fuse-client/syscalls/getattr.ts index 2f641bf..d067311 100644 --- a/packages/fuse-client/syscalls/getattr.ts +++ b/packages/fuse-client/syscalls/getattr.ts @@ -10,7 +10,7 @@ export const getattr: (backend: SQLiteBackend) => MountOptions["getattr"] = ( if (backend.isVirtualFile(path)) { const virtualFile = backend.getVirtualFile(path); - cb(0, virtualFile.getAttr()); + cb(0, virtualFile.attr); return; } diff --git a/packages/fuse-client/syscalls/read.ts b/packages/fuse-client/syscalls/read.ts index f26d918..5395eeb 100644 --- a/packages/fuse-client/syscalls/read.ts +++ b/packages/fuse-client/syscalls/read.ts @@ -10,7 +10,7 @@ export const read: (backend: SQLiteBackend) => MountOptions["read"] = ( if (backend.isVirtualFile(path)) { const virtualFile = backend.getVirtualFile(path); - const bufChunk = virtualFile.getBuffer(); + const bufChunk = virtualFile.buffer; buf.write(bufChunk.toString("binary"), "binary"); cb(Buffer.byteLength(bufChunk)); return; diff --git a/packages/sqlite-backend/VirtualFile.ts b/packages/sqlite-backend/VirtualFile.ts index e078dee..0b3039c 100644 --- a/packages/sqlite-backend/VirtualFile.ts +++ b/packages/sqlite-backend/VirtualFile.ts @@ -14,15 +14,15 @@ export class VirtualFile { return this._fileId; } - getBuffer() { + get buffer() { return Buffer.from(this._content); } - getSize() { - return Buffer.byteLength(this.getBuffer()); + get size() { + return Buffer.byteLength(this.buffer); } - getAttr() { + get attr() { return { mtime: this._date, atime: this._date, @@ -30,7 +30,7 @@ export class VirtualFile { blocks: 1, ino: this.fileId, nlink: 1, - size: this.getSize(), + size: this.size, mode: 33188, uid: process.getuid ? process.getuid() : 0, gid: process.getgid ? process.getgid() : 0,