Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshgillies/node-curli
Simple HTTP HEAD requests in node.js, just like you would with `curl -I`.
https://github.com/joshgillies/node-curli
Last synced: 5 days ago
JSON representation
Simple HTTP HEAD requests in node.js, just like you would with `curl -I`.
- Host: GitHub
- URL: https://github.com/joshgillies/node-curli
- Owner: joshgillies
- License: mit
- Created: 2014-02-24T04:56:07.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-12-14T00:01:41.000Z (almost 10 years ago)
- Last Synced: 2024-10-19T00:15:15.633Z (27 days ago)
- Language: JavaScript
- Size: 281 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# curli
Simple HTTP HEAD requests in node.js, just like you would with `curl -I`.
[![build status](https://secure.travis-ci.org/joshgillies/node-curli.svg)](http://travis-ci.org/joshgillies/node-curli)
[![NPM](https://nodei.co/npm/curli.png?downloads=true&stars=true)](https://nodei.co/npm/curli/)
# Example
```js
var curli = require('curli');curli('http://www.google.com', { 'Cache-Control': 'no-cache' }, function(err, res) {
if (err) return console.error(err);
console.log(res.statusCode, res.headers);
});
```# API
# curli(uri, opts={}, cb)
The first argument `uri` can either be a string or request style object.
Internally if passed a string curli will use `url.parse()` to create an object
that gets passed to `http.request(opts)`.You may also wish to specify custom headers to be sent with the request.
These can be passed via the optional `opts` argument. This is optional as it's
also possible to pass headers via `uri.headers` where `uri` is a `http.request(opts)` style object.The third argument is a standard Node style callback `cb(err, res)` and will be
called once a response is recieved. It returns `err` as an error object or `null`,
and `res` is a standard JavaScript object with the following properties:* res.statusCode - passed forward from `http.request()` `res.statusCode`
* res.headers - passed forward from `http.request()` `res.headers`# Install
`npm install curli`
# License
MIT