https://github.com/nwaughachukwuma/url-exists-nodejs
A node.js library to check if a url exists (with zero dependencies)
https://github.com/nwaughachukwuma/url-exists-nodejs
Last synced: 21 days ago
JSON representation
A node.js library to check if a url exists (with zero dependencies)
- Host: GitHub
- URL: https://github.com/nwaughachukwuma/url-exists-nodejs
- Owner: nwaughachukwuma
- Created: 2021-02-18T07:55:41.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-08-11T19:20:42.000Z (over 3 years ago)
- Last Synced: 2025-05-29T14:14:30.922Z (6 months ago)
- Language: JavaScript
- Size: 350 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# url-exists-nodejs
A node.js library to check if a url exists (with zero dependencies)
## Install
```bash
# pnpm
pnpm install url-exists-nodejs
# yarn
yarn add url-exists-nodejs
# npm
npm install url-exists-nodejs
```
```js
import urlExists from 'url-exists-nodejs'
```
## API
```ts
urlExists(url: string): Promise
```
## Usage
```js
await urlExists('https://google.com') // => true
// a well typed url that can't be found
await urlExists('https://httpbin.org/status/404') // => false
await urlExists('not-a-valid-url') // => false
// can deep check a redirect url
await urlExists('https://bit.ly/300awAn') // => true
```