hoist var in extensions

This commit is contained in:
timothycarambat 2023-12-20 19:41:16 -08:00
parent 31ff4f0832
commit daadad3859
8 changed files with 9 additions and 11 deletions

View File

@ -18,7 +18,7 @@ async function scrapeGenericUrl(link) {
const url = new URL(link);
const filename = (url.host + "-" + url.pathname).replace(".", "_");
data = {
const data = {
id: v4(),
url: "file://" + slugify(filename) + ".html",
title: slugify(filename) + ".html",

View File

@ -46,7 +46,7 @@ async function asAudio({ fullFilePath = "", filename = "" }) {
return { success: false, reason: `No text content found in ${filename}.` };
}
data = {
const data = {
id: v4(),
url: "file://" + fullFilePath,
title: filename,

View File

@ -28,7 +28,7 @@ async function asDocX({ fullFilePath = "", filename = "" }) {
}
const content = pageContent.join("");
data = {
const data = {
id: v4(),
url: "file://" + fullFilePath,
title: filename,

View File

@ -35,7 +35,7 @@ async function asMbox({ fullFilePath = "", filename = "" }) {
`-- Working on message "${mail.subject || "Unknown subject"}" --`
);
data = {
const data = {
id: v4(),
url: "file://" + fullFilePath,
title: mail?.subject

View File

@ -23,7 +23,7 @@ async function asOfficeMime({ fullFilePath = "", filename = "" }) {
return { success: false, reason: `No text content found in ${filename}.` };
}
data = {
const data = {
id: v4(),
url: "file://" + fullFilePath,
title: filename,

View File

@ -18,8 +18,7 @@ async function asPDF({ fullFilePath = "", filename = "" }) {
const docs = await pdfLoader.load();
for (const doc of docs) {
console.log(
`-- Parsing content from pg ${
doc.metadata?.loc?.pageNumber || "unknown"
`-- Parsing content from pg ${doc.metadata?.loc?.pageNumber || "unknown"
} --`
);
if (!doc.pageContent.length) continue;
@ -33,7 +32,7 @@ async function asPDF({ fullFilePath = "", filename = "" }) {
}
const content = pageContent.join("");
data = {
const data = {
id: v4(),
url: "file://" + fullFilePath,
title: docs[0]?.metadata?.pdf?.info?.Title || filename,

View File

@ -23,7 +23,7 @@ async function asTxt({ fullFilePath = "", filename = "" }) {
}
console.log(`-- Working ${filename} --`);
data = {
const data = {
id: v4(),
url: "file://" + fullFilePath,
title: filename,

View File

@ -5,8 +5,7 @@ const {
SUPPORTED_FILETYPE_CONVERTERS,
} = require("../utils/constants");
const { trashFile } = require("../utils/files");
RESERVED_FILES = ["__HOTDIR__.md"];
const RESERVED_FILES = ["__HOTDIR__.md"];
async function processSingleFile(targetFilename) {
const fullFilePath = path.resolve(WATCH_DIRECTORY, targetFilename);