🚀 Launch Week Day 3:Introducing Supply Chain Attack Campaigns Tracking.Learn More →
Socket
Book a DemoInstallSign in
Socket

github-request-all

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-request-all

Iterate and collect all pages of objects for a GitHub API request

latest
Source
npmnpm
Version
2.0.1
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

github-request-all Build Status Dependency Status

Iterate and collect all pages of objects for a GitHub API request.

Example

var ghRequestAll = require('github-request-all')

var requestOpts = {
  url: 'https://api.github.com/users/alanshaw/repos',
  headers: {
    'User-Agent': 'Your application UA' // Required by github
  }
}

ghRequestAll(requestOpts, function (err, results) {
  if (err) throw err
  console.log(results) // All repos for alanshaw
})

ghRequestAll(requestOpts, cb)

Request all pages of the paginated github request. requestOpts are options passed to request and should, at minimum include the URL to request. cb receives the results array.

ghRequestAll(requestOpts, opts, cb)

As above, but the second parameter opts are options for github-request-all:

opts.userAgent

Set the "User-Agent" header (default 'github-request-all').

opts.perPage

Set the number of items requested in a page (default 100).

opts.onPage

Callback called when each page is retrieved.

opts.filter

A function to filter the items collected (applied after opts.onPage is called). A callback for Array.prototype.filter.

Keywords

github

FAQs

Package last updated on 09 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts