Public
Script
1
2
3
4
5
6
7
8
9
10
11
12
import { fetch } from "https://esm.town/v/std/fetch";
export async function extractText(data, name) {
const fileUrl =
"https://www.gcmgrosvenor.com/wp-content/uploads/Private-Credit-Co-investing-GCM-Grosvenor.pdf";
const blob = await fetch(fileUrl).then((r) => r.blob());
const pdfjs = await import("npm:pdfjs-dist"); //https://www.npmjs.com/package/pdf-to-text
return Object.keys(pdfjs);
//const loadingTask = pdfjs.getDocument(blob);
//const doc = await loadingTask.promise;
//return doc.numPages;
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
August 24, 2024