Skip to content

WilliamNHarvey/github-blob-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

github-blob-commit

https://www.npmjs.com/package/github-blob-commit

Single commit for multiple files

githubBlobCommit(options)

Uses Octokat.js

Parameters

parameter type description
options Object options.owner Github repo owner, options.repo repo name, options.auth (optional) passed through to a new
Octokat instance

Example

var githubBlobCommit = require('github-blob-commit')

var options = {
  owner: 'github_username',
  repo: 'github_repo_name'
  auth: {
    username: "USER_NAME",
    password: "PASSWORD"
    //Or token: "TOKEN"
  }
}

var gh = githubBlobCommit(options)
filesToCommit = [];
fs.readdir("/files/", (err, files) => {
  files.forEach(file => {
    filesToCommit.push({
      path: "/files/"+file,
      content: fs.readFileSync("/files/"+file, "utf8") //optional
    })
  });
  gh.commitFiles(filesToCommit, "github_repo_branch", function(err, data) {
    console.log("Committed");
  })
});

Installation

$ npm install --save github-blob-commit

About

Push up multiple files in one commit :octocat::shipit:

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published