request-all
v2.0.2
Published
Performs a multiple requests and data from all pages are concatenated together and buffered until the last page of data has been retrieved. Use it as standalone module or as wrapper for simple-get - just pass simple-get.
Downloads
11
Readme
request-all
Performs a multiple requests and data from all pages are concatenated together and buffered until the last page of data has been retrieved. Use it as standalone module or as wrapper for simple-get - just pass simple-get.
ProTips
- use
v1.x
if you want to use/pass[email protected]
, npm tagged aslatest-1
- use
v2.x
if you want to use/pass[email protected]
, npm tagged aslatest
Install
npm i request-all --save
Usage
For more use-cases see the tests
const requestAll = require('request-all')
requestAll
Perform multiple requests until the last page of data has been retrieved.
Params
url
{Function|String|Object}: thesimple-get
function, url, or object[opts]
{Object}: optional options,url
andopts
are merged if both are objects<cb>
{Function}: callbackfunction, you can pass it as second argumentreturns
{Function}: the simple-get function, only if given as first argument,undefined
otherwise
Example
const requestAll = require('request-all')
requestAll('https://api.github.com/users/tunnckoCore/repos', (err, data) => {
if (err) return console.error(err)
console.log(data.length) // => 200+ repos
})
Usage as wrapper
If you pass simple-get to it or any request library that have
.concat
method, it just returns it and adds.requestAll
method.
Example
const simpleGet = require('request-all')(require('simple-get'))
simpleGet.requestAll('http://httpbin.org/ip', {json: false}, (err, buf) => {
if (err) return console.error(err)
console.log(buf.toString()) // => '{"origin": "33.125.89.244"}'
})
Related
- github-base: Base methods for creating node.js apps that work with the GitHub… more | homepage
- simple-get: Simplest way to make http get requests. Supports HTTPS, redirects, gzip/deflate,… more | homepage
- simple-get-stream: Simply wraps
simple-get
and his methods to return Response stream instead… more | homepage - then-got: Promisified
simple-get
. | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.