ganze project

This commit is contained in:
2025-12-15 19:52:56 +01:00
commit bc9b07ca4e
521 changed files with 361138 additions and 0 deletions

96
node_modules/pdf-parse/dist/node/cjs/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,96 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/node/index.ts
var index_exports = {};
__export(index_exports, {
getHeader: () => getHeader
});
module.exports = __toCommonJS(index_exports);
// src/node/getHeader.ts
var http = __toESM(require("node:http"), 1);
var https = __toESM(require("node:https"), 1);
async function nodeRequest(u, method, headers) {
return new Promise((resolve, reject) => {
const reqFn = u.protocol === "https:" ? https.request : http.request;
const req = reqFn(u, { method, headers }, (res) => {
const headersObj = {};
for (const [k, v] of Object.entries(res.headers)) {
headersObj[k] = Array.isArray(v) ? v.join(",") : v ?? "";
}
const chunks = [];
res.on("data", (c) => chunks.push(Buffer.from(c)));
res.on("end", () => {
const buffer = chunks.length ? Buffer.concat(chunks) : void 0;
resolve({ status: res.statusCode ?? 0, headers: headersObj, buffer });
});
});
req.on("error", (err) => reject(err));
req.end();
});
}
async function getHeader(url, check = false) {
try {
const u = typeof url === "string" ? new URL(url) : url;
const headResp = await nodeRequest(u, "HEAD");
const size = headResp.headers["content-length"] ? parseInt(headResp.headers["content-length"], 10) : void 0;
let magic = null;
if (check) {
const rangeResp = await nodeRequest(u, "GET", { Range: "bytes=0-4" });
if (rangeResp.status >= 200 && rangeResp.status < 300 && rangeResp.buffer) {
const headerStr = rangeResp.buffer.slice(0, 4).toString("utf8");
magic = headerStr.startsWith("%PDF");
} else {
magic = false;
}
}
return {
ok: headResp.status >= 200 && headResp.status < 300,
status: headResp.status,
size,
magic,
headers: headResp.headers
};
} catch (error) {
return {
ok: false,
status: void 0,
size: void 0,
magic: false,
headers: {},
error: new Error(String(error))
};
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getHeader
});
//# sourceMappingURL=index.cjs.map

7
node_modules/pdf-parse/dist/node/cjs/index.cjs.map generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../../src/node/index.ts", "../../../src/node/getHeader.ts"],
"sourcesContent": ["export type * from './getHeader.js';\nexport * from './getHeader.js';\n", "import * as http from 'node:http';\nimport * as https from 'node:https';\n\n/**\n * Result information from getHeader.\n * @public\n */\nexport interface HeaderResult {\n\tok: boolean;\n\tstatus?: number;\n\tsize?: number;\n\tmagic: boolean | null;\n\theaders?: Record<string, string>;\n\terror?: Error;\n}\n\ninterface RequestResult {\n\tstatus: number;\n\theaders: Record<string, string>;\n\tbuffer?: Buffer;\n}\n\nasync function nodeRequest(u: URL, method: string, headers?: Record<string, string>): Promise<RequestResult> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst reqFn = u.protocol === 'https:' ? https.request : http.request;\n\t\tconst req = reqFn(u, { method, headers }, (res) => {\n\t\t\tconst headersObj: Record<string, string> = {};\n\t\t\tfor (const [k, v] of Object.entries(res.headers)) {\n\t\t\t\theadersObj[k] = Array.isArray(v) ? v.join(',') : (v ?? '');\n\t\t\t}\n\n\t\t\tconst chunks: Buffer[] = [];\n\t\t\tres.on('data', (c) => chunks.push(Buffer.from(c)));\n\t\t\tres.on('end', () => {\n\t\t\t\tconst buffer = chunks.length ? Buffer.concat(chunks) : undefined;\n\t\t\t\tresolve({ status: res.statusCode ?? 0, headers: headersObj, buffer });\n\t\t\t});\n\t\t});\n\n\t\treq.on('error', (err) => reject(err));\n\t\treq.end();\n\t});\n}\n\n/**\n * Perform an HTTP HEAD request to retrieve the file size and verify existence;\n * when `check` is true, fetch a small range and inspect the magic number to confirm the URL points to a valid PDF.\n * If the server does not support range requests, `isPdf` will be set to `false`.\n * @param url - The URL of the PDF file to check. Can be a string or URL object.\n * @param check - When `true`, download a small byte range (first 4 bytes) to validate the file signature by checking for '%PDF' magic bytes. Default: `false`.\n * @returns - A Promise that resolves to a HeaderResult object containing the response status, size, headers, and PDF validation result.\n * @public\n */\nexport async function getHeader(url: string | URL, check: boolean = false): Promise<HeaderResult> {\n\ttry {\n\t\tconst u = typeof url === 'string' ? new URL(url) : url;\n\n\t\tconst headResp = await nodeRequest(u, 'HEAD');\n\t\tconst size = headResp.headers['content-length'] ? parseInt(headResp.headers['content-length'], 10) : undefined;\n\n\t\tlet magic: boolean | null = null;\n\t\tif (check) {\n\t\t\tconst rangeResp = await nodeRequest(u, 'GET', { Range: 'bytes=0-4' });\n\t\t\tif (rangeResp.status >= 200 && rangeResp.status < 300 && rangeResp.buffer) {\n\t\t\t\tconst headerStr = rangeResp.buffer.slice(0, 4).toString('utf8');\n\t\t\t\tmagic = headerStr.startsWith('%PDF');\n\t\t\t} else {\n\t\t\t\tmagic = false;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tok: headResp.status >= 200 && headResp.status < 300,\n\t\t\tstatus: headResp.status,\n\t\t\tsize,\n\t\t\tmagic,\n\t\t\theaders: headResp.headers,\n\t\t};\n\t} catch (error) {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,SAAS,QAAQ,gBAAgB,GAAG,EAAE,IAAI;AAErG,QAAI,QAAwB;AAC5B,QAAI,OAAO;AACV,YAAM,YAAY,MAAM,YAAY,GAAG,OAAO,EAAE,OAAO,YAAY,CAAC;AACpE,UAAI,UAAU,UAAU,OAAO,UAAU,SAAS,OAAO,UAAU,QAAQ;AAC1E,cAAM,YAAY,UAAU,OAAO,MAAM,GAAG,CAAC,EAAE,SAAS,MAAM;AAC9D,gBAAQ,UAAU,WAAW,MAAM;AAAA,MACpC,OAAO;AACN,gBAAQ;AAAA,MACT;AAAA,IACD;AAEA,WAAO;AAAA,MACN,IAAI,SAAS,UAAU,OAAO,SAAS,SAAS;AAAA,MAChD,QAAQ,SAAS;AAAA,MACjB;AAAA,MACA;AAAA,MACA,SAAS,SAAS;AAAA,IACnB;AAAA,EACD,SAAS,OAAO;AACf,WAAO;AAAA,MACN,IAAI;AAAA,MACJ,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MACP,SAAS,CAAC;AAAA,MACV,OAAO,IAAI,MAAM,OAAO,KAAK,CAAC;AAAA,IAC/B;AAAA,EACD;AACD;",
"names": []
}

25
node_modules/pdf-parse/dist/node/cjs/index.d.cts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
/**
* Perform an HTTP HEAD request to retrieve the file size and verify existence;
* when `check` is true, fetch a small range and inspect the magic number to confirm the URL points to a valid PDF.
* If the server does not support range requests, `isPdf` will be set to `false`.
* @param url - The URL of the PDF file to check. Can be a string or URL object.
* @param check - When `true`, download a small byte range (first 4 bytes) to validate the file signature by checking for '%PDF' magic bytes. Default: `false`.
* @returns - A Promise that resolves to a HeaderResult object containing the response status, size, headers, and PDF validation result.
* @public
*/
export declare function getHeader(url: string | URL, check?: boolean): Promise<HeaderResult>;
/**
* Result information from getHeader.
* @public
*/
export declare interface HeaderResult {
ok: boolean;
status?: number;
size?: number;
magic: boolean | null;
headers?: Record<string, string>;
error?: Error;
}
export { }

23
node_modules/pdf-parse/dist/node/esm/getHeader.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
/**
* Result information from getHeader.
* @public
*/
export interface HeaderResult {
ok: boolean;
status?: number;
size?: number;
magic: boolean | null;
headers?: Record<string, string>;
error?: Error;
}
/**
* Perform an HTTP HEAD request to retrieve the file size and verify existence;
* when `check` is true, fetch a small range and inspect the magic number to confirm the URL points to a valid PDF.
* If the server does not support range requests, `isPdf` will be set to `false`.
* @param url - The URL of the PDF file to check. Can be a string or URL object.
* @param check - When `true`, download a small byte range (first 4 bytes) to validate the file signature by checking for '%PDF' magic bytes. Default: `false`.
* @returns - A Promise that resolves to a HeaderResult object containing the response status, size, headers, and PDF validation result.
* @public
*/
export declare function getHeader(url: string | URL, check?: boolean): Promise<HeaderResult>;
//# sourceMappingURL=getHeader.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getHeader.d.ts","sourceRoot":"","sources":["../../../src/node/getHeader.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,KAAK,CAAC;CACd;AA8BD;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,YAAY,CAAC,CAmChG"}

66
node_modules/pdf-parse/dist/node/esm/getHeader.js generated vendored Normal file
View File

@@ -0,0 +1,66 @@
import * as http from 'node:http';
import * as https from 'node:https';
async function nodeRequest(u, method, headers) {
return new Promise((resolve, reject) => {
const reqFn = u.protocol === 'https:' ? https.request : http.request;
const req = reqFn(u, { method, headers }, (res) => {
const headersObj = {};
for (const [k, v] of Object.entries(res.headers)) {
headersObj[k] = Array.isArray(v) ? v.join(',') : (v ?? '');
}
const chunks = [];
res.on('data', (c) => chunks.push(Buffer.from(c)));
res.on('end', () => {
const buffer = chunks.length ? Buffer.concat(chunks) : undefined;
resolve({ status: res.statusCode ?? 0, headers: headersObj, buffer });
});
});
req.on('error', (err) => reject(err));
req.end();
});
}
/**
* Perform an HTTP HEAD request to retrieve the file size and verify existence;
* when `check` is true, fetch a small range and inspect the magic number to confirm the URL points to a valid PDF.
* If the server does not support range requests, `isPdf` will be set to `false`.
* @param url - The URL of the PDF file to check. Can be a string or URL object.
* @param check - When `true`, download a small byte range (first 4 bytes) to validate the file signature by checking for '%PDF' magic bytes. Default: `false`.
* @returns - A Promise that resolves to a HeaderResult object containing the response status, size, headers, and PDF validation result.
* @public
*/
export async function getHeader(url, check = false) {
try {
const u = typeof url === 'string' ? new URL(url) : url;
const headResp = await nodeRequest(u, 'HEAD');
const size = headResp.headers['content-length'] ? parseInt(headResp.headers['content-length'], 10) : undefined;
let magic = null;
if (check) {
const rangeResp = await nodeRequest(u, 'GET', { Range: 'bytes=0-4' });
if (rangeResp.status >= 200 && rangeResp.status < 300 && rangeResp.buffer) {
const headerStr = rangeResp.buffer.slice(0, 4).toString('utf8');
magic = headerStr.startsWith('%PDF');
}
else {
magic = false;
}
}
return {
ok: headResp.status >= 200 && headResp.status < 300,
status: headResp.status,
size,
magic,
headers: headResp.headers,
};
}
catch (error) {
return {
ok: false,
status: undefined,
size: undefined,
magic: false,
headers: {},
error: new Error(String(error)),
};
}
}
//# sourceMappingURL=getHeader.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getHeader.js","sourceRoot":"","sources":["../../../src/node/getHeader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAqBpC,KAAK,UAAU,WAAW,CAAC,CAAM,EAAE,MAAc,EAAE,OAA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AM,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG;YACnD,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,IAAI;YACJ,KAAK;YACL,OAAO,EAAE,QAAQ,CAAC,OAAO;SACzB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO;YACN,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SAC/B,CAAC;IACH,CAAC;AACF,CAAC"}

3
node_modules/pdf-parse/dist/node/esm/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export type * from './getHeader.js';
export * from './getHeader.js';
//# sourceMappingURL=index.d.ts.map

1
node_modules/pdf-parse/dist/node/esm/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,gBAAgB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}

2
node_modules/pdf-parse/dist/node/esm/index.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export * from './getHeader.js';
//# sourceMappingURL=index.js.map

1
node_modules/pdf-parse/dist/node/esm/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC"}