pdf-parse-test
Version:
Pure TypeScript, cross-platform module for extracting text, images, and tabular data from PDFs. Run directly in your browser or in Node!
18 lines • 963 B
TypeScript
export interface HeaderResult {
ok: boolean;
status?: number;
size?: number;
isPdf?: boolean;
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.
*/
export declare function getHeader(url: string | URL, check?: boolean): Promise<HeaderResult>;
//# sourceMappingURL=HeaderResult.d.ts.map