import Repository from "./repo"; import FSDataStore from "./datasources/fs"; import * as Fs from "fs"; const t = (t: string) => new TextEncoder().encode(t); async function test() { await Fs.promises.rm("./testrepo", { recursive: true, force: true }); const ds = new FSDataStore("./testrepo"); const rep = new Repository(ds); console.log(new TextDecoder().decode(await rep.read("hi.txt"))); await Promise.all([ rep.write("hi.txt", t("Hallo Welt: " + new Date().toLocaleString())), rep.write("hi_hallo.txt", t("Hallo Welt: " + new Date().toLocaleString())), rep.write("hi_hallo3.txt", t("Hallo Welt: " + new Date().toLocaleString())), ]); console.log(new TextDecoder().decode(await rep.read("hi.txt"))); console.log((await rep.readdir("/"))?.map((e) => e[2])); await rep.close(); } test();