fast-head
v0.0.2
Published
Fetch http(s) headers and statusCode or error.
Downloads
5
Maintainers
Readme
fast-head
Fetch http(s) headers and statusCode or error.
Install
npm install --save fast-head
# or, with yarn
yarn add fast-head
Usage
const fastHead = require('fast-head');
fastHead('http://www.yamaska.ca/')
.then(({ elapsed, headers, statusCode, error }) => {
// either headers and status code are filled,
// or it's error
})
.catch(console.error)
API
fastHead(url, [timeout])
url
Type: string
- http://www.yamaska.ca/
- https://www.yamaska.ca/
- Etc.
timeout (optionnal)
Type: number
in ms
Default: 5000
See fastHead.defaultTimeout.
fastHead.defaultTimeout
Type: number
in ms
To obtain the value of the default timeout. Since there's a single fastHead
, it's best not to change this field. Want to contribute and make it read-only?
Contribute
Contributions are appreciated! Here are a few ideas to get you started:
License
AGPL-v3 © 2017 Robin Millette