Skip to main content
Module

x/deno_isup/mod.ts

A (very) simple module to check whether a host is up or not.
File
export async function isUp(urlString: string) { if (!['http://', 'https://'].some(protocol => urlString.startsWith(protocol))) { urlString = 'https://' + urlString }
const url = new URL(urlString)
return await fetch(url).then((res: Response) => { res.body?.cancel() return true }).catch((res: Response) => { res.body?.cancel() return false })}