Skip to content

Commit

Permalink
hoist var in extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycarambat committed Dec 21, 2023
1 parent 31ff4f0 commit daadad3
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion collector/processLink/convert/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion collector/processSingleFile/convert/asAudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion collector/processSingleFile/convert/asDocx.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function asDocX({ fullFilePath = "", filename = "" }) {
}

const content = pageContent.join("");
data = {
const data = {
id: v4(),
url: "file://" + fullFilePath,
title: filename,
Expand Down
2 changes: 1 addition & 1 deletion collector/processSingleFile/convert/asMbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion collector/processSingleFile/convert/asOfficeMime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 2 additions & 3 deletions collector/processSingleFile/convert/asPDF.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion collector/processSingleFile/convert/asTxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function asTxt({ fullFilePath = "", filename = "" }) {
}

console.log(`-- Working ${filename} --`);
data = {
const data = {
id: v4(),
url: "file://" + fullFilePath,
title: filename,
Expand Down
3 changes: 1 addition & 2 deletions collector/processSingleFile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit daadad3

Please sign in to comment.