Node website uptime checker (built on top of node-libcurl)
Checks uptime status of given url and provided keyword (optional).
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".
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:
``typescript
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
}
`
option any more. If you used this, please migrate to:`js
check({
headers: {
'User-Agent': 'Your custom UA string',
}
});
`Example usage
`javascript
import check from 'uptime-check';
const result = await check({
url: 'https://example.com',
keyword: 'Example',
allowRedirects: true,
});const isUp = result.success; // true or false
``