Visitar URL original
GitHub - stdclass/github: A higher-level wrapper around the Github API. Intended for the browser.
The Wayback Machine - https://web.archive.org/web/20210112064451/https://github.com/stdclass/github
Skip to content
master
Go to file
Code
This branch is 2 commits ahead, 517 commits behind github-tools:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

Github.js

Ever wanted to store a file on Github right from the browser? Here you are.

Expose API for a given repository.

var github = new Github({
  username: "YOU_USER",
  password: "YOUR_PASSWORD",
  auth: "basic"
});

var repo = github.getRepo(reponame);

Retrieve all available branches (aka heads) of a repository.

repo.listBranches(function(err, branches) {
  
});

Store contents at a certain path, where files that don't yet exist are created on the fly.

repo.write('master', 'path/to/file', 'YOUR_NEW_CONTENTS', 'YOUR_COMMIT_MESSAGE', function(err) {
  
});

Not only can you can write files, you can of course read them.

// Retrieve contents of a certain file (assumes UTF-8)

repo.read('master', 'path/to/file', function(err, data) {
  
});

Listing all files of a repository is easy too.

repo.list('master', 'path/to/file', function(err, data) {
  
});

Node.js

To use Github.js on a node.js server, include it with require():

var Github = require("/path/to/github.js");

var github = new Github({
  username: "YOU_USER",
  password: "YOUR_PASSWORD",
  auth: "basic"
});

About

A higher-level wrapper around the Github API. Intended for the browser.

Resources

License

Packages

No packages published
You can’t perform that action at this time.