mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-27 13:04:20 +01:00
We don't expect any return value from the underlying `fsync()` so fix
the function signature accordingly.
Fixes the following obscure error:
```
TypeError: Cannot convert undefined to a BigInt
at wasm://wasm/00942492:wasm-function[1501]:0x1c4dc1
at wasm://wasm/00942492:wasm-function[694]:0x189586
at wasm://wasm/00942492:wasm-function[50]:0x143d7
at wasm://wasm/00942492:wasm-function[60]:0x3f91a
at new Database (/Users/penberg/src/penberg/limbo/bindings/wasm/pkg/limbo_wasm.js:162:26)
at file:///Users/penberg/src/penberg/limbo/bindings/wasm/perf/perf-limbo.js:5:12
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
at async loadESM (node:internal/process/esm_loader:34:7)
at async handleMainPromise (node:internal/modules/run_main:106:12)
```
34 lines
519 B
JavaScript
34 lines
519 B
JavaScript
const fs = require('node:fs');
|
|
|
|
class VFS {
|
|
constructor() {
|
|
}
|
|
|
|
open(path, flags) {
|
|
return fs.openSync(path, flags);
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
sync(fd) {
|
|
fs.fsyncSync(fd);
|
|
}
|
|
}
|
|
|
|
module.exports = { VFS };
|