Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

github-data

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-data

Tools for running git commands without git.

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

GitHub Data

Build Status Coverage Status

NPM

This is essentially a Node.js interface to make low-level git calls through the GitHub Git Data API.

Docs are in the docs folder. Here's a simple example of how to use it.

Low level git plumbing objects are available to do pretty much whatever you want with. There is also a GitFile inteface that tries to simplify some things. But it has only been tested with files in the root directory of the repository.

var GitData = require('./index');
var username = process.env['GH_USERNAME'];
var authToken = process.env['GH_PASSWORD'];

var gdata = new GitData(username, authToken, "numenta", "experiments");

gdata.getBranch("master", function(err, master) {
    console.log('branch: ' + master.ref);

    master.getFile('temp.txt', function(err, file) {
        console.log(file);
        file.blob.setContents(file.blob.getContents() + '\nUpdated on: ' + new Date());
        file.commit('Updated through GitFile interface.', function(err, commit) {
            // Still have to push the new commit.
            master.push(commit, function(err) {
                console.log('push done!');
                master.getCommit(function(error, latestCommit) {
                    console.log(latestCommit);
                });
            });
        });
    });

});

Keywords

git

FAQs

Package last updated on 11 May 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