linkinator
- Version 7.5.1
- Published
- 138 kB
- 11 dependencies
- MIT license
Install
npm i linkinatoryarn add linkinatorpnpm add linkinatorOverview
Find broken links, missing images, etc in your HTML. Scurry around your site and find all those broken links.
Index
Functions
function check
check: ( options: CheckOptions) => Promise<{ links: LinkResult[]; passed: boolean }>;Convenience method to perform a scan.
Parameter options
CheckOptions to be passed on
function getConfig
getConfig: (flags: Flags) => Promise<Flags>;function resetSharedAgents
resetSharedAgents: () => void;Reset the shared insecure HTTP agent. This is primarily useful for testing to ensure a fresh agent state between tests.
Classes
class LinkChecker
class LinkChecker extends EventEmitter {}Instance class used to perform a crawl job.
method check
check: ( options_: CheckOptions) => Promise<{ links: LinkResult[]; passed: boolean }>;Crawl a given url or path, and return a list of visited links along with status codes.
Parameter options
Options to use while checking for 404s
method crawl
crawl: (options: CrawlOptions) => Promise<void>;Crawl a given url with the provided options. opts List of options used to do the crawl
Returns
A list of crawl results consisting of urls and status codes
method on
on: { (event: 'link', listener: (result: LinkResult) => void): this; (event: 'pagestart', listener: (link: string) => void): this; (event: 'retry', listener: (details: RetryInfo) => void): this; (event: 'redirect', listener: (details: RedirectInfo) => void): this; (event: 'httpInsecure', listener: (details: HttpInsecureInfo) => void): this; ( event: 'statusCodeWarning', listener: (details: StatusCodeWarning) => void ): this;};method shouldRetryAfter
shouldRetryAfter: (response: HttpResponse, options: CrawlOptions) => boolean;Check the incoming response for a
retry-afterheader. If present, and if the status was an HTTP 429, calculate the date at which this request should be retried. Ensure the delayCache knows that we're going to wait on requests for this entire host.Parameter response
HttpResponse returned from the request
Parameter opts
CrawlOptions used during this request
method shouldRetryOnError
shouldRetryOnError: (status: number, options: CrawlOptions) => boolean;If the response is a 5xx, synthetic 0 or 429 without retry-after header retry N times. There are cases where we can get 429 but without retry-after data, for those cases we are going to handle it as error so we can retry N times.
Parameter status
Status returned by request or 0 if request threw.
Parameter opts
CrawlOptions used during this request
Enums
Type Aliases
type CheckOptions
type CheckOptions = { concurrency?: number; port?: number; path: string | string[]; recurse?: boolean; timeout?: number; markdown?: boolean; linksToSkip?: string[] | ((link: string) => Promise<boolean>); serverRoot?: string; directoryListing?: boolean; cleanUrls?: boolean; retry?: boolean; retryErrors?: boolean; retryErrorsCount?: number; retryErrorsJitter?: number; urlRewriteExpressions?: UrlRewriteExpression[]; userAgent?: string; headers?: Record<string, string>; redirects?: 'allow' | 'warn' | 'error'; requireHttps?: 'off' | 'warn' | 'error'; allowInsecureCerts?: boolean; checkCss?: boolean; checkFragments?: boolean; statusCodes?: Record<string, StatusCodeAction>;};type CrawlResult
type CrawlResult = { passed: boolean; links: LinkResult[];};type HttpInsecureInfo
type HttpInsecureInfo = { url: string;};type HttpResponse
type HttpResponse = { status: number; headers: Record<string, string>; body?: ReadableStream; url?: string;};type LinkResult
type LinkResult = { url: string; status?: number; state: LinkState; parent?: string; failureDetails?: Array<Error | HttpResponse>;};type RedirectInfo
type RedirectInfo = { url: string; targetUrl?: string; status: number; isNonStandard: boolean;};type RetryInfo
type RetryInfo = { url: string; secondsUntilRetry: number; status: number;};type StatusCodeWarning
type StatusCodeWarning = { url: string; status: number;};Package Files (3)
Dependencies (11)
Dev Dependencies (9)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/linkinator.
- Markdown[](https://www.jsdocs.io/package/linkinator)
- HTML<a href="https://www.jsdocs.io/package/linkinator"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3206 ms. - Missing or incorrect documentation? Open an issue for this package.
