新版本

This commit is contained in:
dodgerblue25 committed 2026-10-26 12:54:09 +08:00
commit 8945301baf
508 files changed
+54357

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
import { PFile, PFiles } from "./file.ts";
import { DocuBuilder } from "./pdf_builder/docu_builder.ts";
import { IndexBuilder } from "./pdf_builder/index_builder.ts";
import { PDFParse } from "pdf-parse";
// Deno.test("PFiles initialization", () => {
// const pfiles = new PFiles("./mobile_src");
// console.log(pfiles);
// });
// Deno.test("PDF generate", async () => {
// const builder = new DocuBuilder();
// try {
// await builder.with_browser();
// const cfg = JSON.parse(await Deno.readTextFile("config.json"));
// for (const config of cfg.settings) {
// console.debug(`Processing config: ${JSON.stringify(config)}`);
// builder.with_files_sync(config.journal.from_directory);
// builder.as_html_page();
// await builder.build_as_pdf(config.playwright);
// }
// } finally {
// await builder.close_browser();
// }
// });
// Deno.test({
// name: "IndexBuilder test",
// sanitizeOps: false,
// sanitizeResources: false,
// async fn() {
// },
// });
import { ripgrep } from "ripgrep";
Deno.test("ripgrep test", async () => {
let pattern = "NULL ";
const cmd = new Deno.Command("rg", {
args: ["-q", "-F", pattern],
stdin: "piped",
stdout: "piped",
stderr: "piped",
});
const child = cmd.spawn();
const writer = child.stdin.getWriter();
await writer.write(
new TextEncoder().encode("This is a test string with NULL in it."),
);
writer.releaseLock();
const { code, stdout, stderr } = await child.output();
console.log(`Exit code: ${code}`);
console.log(`stdout: ${new TextDecoder().decode(stdout)}`);
console.log(`stderr: ${new TextDecoder().decode(stderr)}`);
});