a github api for node and browser

Usage no npm install needed!

<script type="module">
  import ghapi from '';


github api (ghapi)

A github api for node and the browser.


npm install ghapi
var api = require('ghapi')
api(command, arg_1, ..., arg_n [, parameters, callback])

See commands.js for a list of all the commands. The file is compiled by scraping all the commands form the Github API documentation. Consult the Github documentation for parameters associated with each api call. For commands requiring authentication, append an auth object to parameters.

Create a new gist

POST /gists
api('createGist', parameters)
var files = { 
  'api.txt': { 
    content: 'hello!' 
var basicAuth = { 
  user: 'user', 
  pass: 'pass' 
api('createGist', { files: files, auth: basicAuth }).pipe(process.stdout);

Fork a gist

POST /gists/:id/forks
api('createGistFork', id, parameters);
var bearerAuth = { bearer: 'access token' } // github access token
api('createGistFork', '1',  { auth: bearerAuth }, function (err, res, body) {


  • Add tests and documentation