Skip to content

michapixel/github

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github.js

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

Create a Github instance.

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

Or if you prefer OAuth, it looks like this:

var github = new Github({
  token: "OAUTH_TOKEN"
  auth: "oauth"
});

Expose API for a given repository.

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.

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

Move a file from A to B.

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

Remove a file.

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

Listing all files of a repository is easy too.

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy