find-reachable-urls

1.1.1 • Public • Published

find-reachable-urls Build Status

Passes back all URLs which respond with status code 200.

Installation

npm install find-reachable-urls --save

Usage

const findReachableUrls = require('find-reachable-urls')
const urls = [
  'https://google.com', // 200
  'https://github.com/nonexistent-url', // 404
  'https://github.com/OctoLinker/chrome-extension', // 301
]
 
findReachableUrls(urls)
  .then(function(result) {
    console.log(result)
    // ['https://google.com', 'https://github.com/OctoLinker/chrome-extension']
  })
  .catch(function(err) {
    // handle error
  })

findReachableUrls(urls, [options], [callback])

Returns a Promise with all reachable urls.

urls

Type: string, array

The URL(s) to check.

options

Type: object

firstMatch

Type: boolean

Default: false

If true it returns the first reachable url and stops any further requests. If none of the urls is reachable it returns undefined.

Tests

npm install
npm test

Related

  • heads: Make parallel HEAD requests for an array of URLs and get back their HTTP status codes.

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.1
    9
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.1
    9
  • 1.1.0
    1
  • 1.0.0
    1
  • 0.1.0
    1

Package Sidebar

Install

npm i find-reachable-urls

Weekly Downloads

10

Version

1.1.1

License

MIT

Last publish

Collaborators

  • stefanbuck