github-blob-commit

1.2.2 • Public • Published

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

/github-blob-commit/

    Package Sidebar

    Install

    npm i github-blob-commit

    Weekly Downloads

    2

    Version

    1.2.2

    License

    MIT

    Unpacked Size

    7.37 kB

    Total Files

    3

    Last publish

    Collaborators

    • williamnharvey