Skip to content

Commit 3616a9b

Browse files
committed
chore: unify VirtualFile API
1 parent 0f8a5c9 commit 3616a9b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

packages/fuse-client/syscalls/getattr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const getattr: (backend: SQLiteBackend) => MountOptions["getattr"] = (
1010

1111
if (backend.isVirtualFile(path)) {
1212
const virtualFile = backend.getVirtualFile(path);
13-
cb(0, virtualFile.getAttr());
13+
cb(0, virtualFile.attr);
1414
return;
1515
}
1616

packages/fuse-client/syscalls/read.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const read: (backend: SQLiteBackend) => MountOptions["read"] = (
1010

1111
if (backend.isVirtualFile(path)) {
1212
const virtualFile = backend.getVirtualFile(path);
13-
const bufChunk = virtualFile.getBuffer();
13+
const bufChunk = virtualFile.buffer;
1414
buf.write(bufChunk.toString("binary"), "binary");
1515
cb(Buffer.byteLength(bufChunk));
1616
return;

packages/sqlite-backend/VirtualFile.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ export class VirtualFile {
1414
return this._fileId;
1515
}
1616

17-
getBuffer() {
17+
get buffer() {
1818
return Buffer.from(this._content);
1919
}
2020

21-
getSize() {
22-
return Buffer.byteLength(this.getBuffer());
21+
get size() {
22+
return Buffer.byteLength(this.buffer);
2323
}
2424

25-
getAttr() {
25+
get attr() {
2626
return {
2727
mtime: this._date,
2828
atime: this._date,
2929
ctime: this._date,
3030
blocks: 1,
3131
ino: this.fileId,
3232
nlink: 1,
33-
size: this.getSize(),
33+
size: this.size,
3434
mode: 33188,
3535
uid: process.getuid ? process.getuid() : 0,
3636
gid: process.getgid ? process.getgid() : 0,

0 commit comments

Comments
 (0)