@fireproof/core-gateways-file-node
Version:
Live ledger for the web.
34 lines • 946 B
JavaScript
import { toArrayBuffer } from "./to-array-buffer.js";
export class NodeFileSystem {
fs;
async start() {
this.fs = await import("node:fs/promises");
return this;
}
async mkdir(path, options) {
return this.fs?.mkdir(path, options);
}
async readdir(path, options) {
return this.fs?.readdir(path, options);
}
async rm(path, options) {
return this.fs?.rm(path, options);
}
async copyFile(source, destination) {
return this.fs?.copyFile(source, destination);
}
async readfile(path, options) {
const ret = (await this.fs?.readFile(path, options));
return toArrayBuffer(ret);
}
stat(path) {
return this.fs?.stat(path);
}
async unlink(path) {
return this.fs?.unlink(path);
}
async writefile(path, data) {
return this.fs?.writeFile(path, data);
}
}
//# sourceMappingURL=node-filesystem.js.map