plc-replica/full-scan.ts

18 lines
571 B
TypeScript
Raw Normal View History

2024-11-27 16:30:50 +00:00
import { TextLineStream } from "jsr:@std/streams@1/text-line-stream";
import { ExportEntry } from "./directory-tailer.ts";
import { tailer } from "./main.ts";
export const fullScan = async () => {
using exports = await Deno.open("./data/exports.jsonl", { read: true });
const lineStream = exports.readable
.pipeThrough(new TextDecoderStream())
.pipeThrough(new TextLineStream());
for await (const line of lineStream.values()) {
const entry = JSON.parse(line) as unknown as ExportEntry;
await tailer.processRecord(entry);
}
};
await fullScan();