uptime-check
v5.0.0-next.1
Published
Node website uptime checker (built on top of node-libcurl)
Maintainers
Readme
Uptime check
Checks uptime status of given url and provided keyword (optional).
How it works
Makes simple fetch requests, gathers data on response and if requested also is looking for a keyword inside the document body.
If http code (response) is 2xx website is considered "up". If there is a keyword given for search, but the keyword cannot be found in the document body, website is considered "down".
v5 migration
From version 5 this package becomes 0-depencency. With that got got replaced with native fetch.
For the sake of maintenance ease, node@24 or higher is required.
To migrate please check the new function signature and returned result:
declare module "uptime-check" {
export interface UptimeCheckResult {
success: boolean; // true if test passed, false if failed
statusCode: number;
didRedirect: boolean;
effectiveUrl: string; // last url in the redirects chain
totalTime: number; // total request time
thrownError?: Error; // in case of fetch error, original Error object
thrownErrorCode?: string; // in case of a request error, e.g. ETIMEDOUT, CERT_HAS_EXPIRED, when provided
}
export interface UptimeCheckOptions {
url: string;
keyword?: string; // defaults to null
allowRedirects: boolean; // defaults to false
headers?: object;
}
export default function check(o: UptimeCheckOptions): Promise<UptimeCheckResult>;
}v4 migration
From version 4 there is no userAgent option any more. If you used this, please migrate to:
check({
headers: {
'User-Agent': 'Your custom UA string',
}
});Example usage
import check from 'uptime-check';
const result = await check({
url: 'https://example.com',
keyword: 'Example',
allowRedirects: true,
});
const isUp = result.success; // true or false