mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-10 11:44:22 +01:00
30 lines
470 B
JavaScript
30 lines
470 B
JavaScript
const fs = require('node:fs');
|
|
|
|
class VFS {
|
|
constructor() {
|
|
}
|
|
|
|
open(path) {
|
|
return fs.openSync(path, 'r');
|
|
}
|
|
|
|
close(fd) {
|
|
fs.closeSync(fd);
|
|
}
|
|
|
|
pread(fd, buffer, offset) {
|
|
return fs.readSync(fd, buffer, 0, buffer.length, offset);
|
|
}
|
|
|
|
pwrite(fd, buffer, offset) {
|
|
return fs.writeSync(fd, buffer, 0, buffer.length, offset);
|
|
}
|
|
|
|
size(fd) {
|
|
let stats = fs.fstatSync(fd);
|
|
return BigInt(stats.size);
|
|
}
|
|
}
|
|
|
|
module.exports = { VFS };
|