Publishes a file to a repository through the GitHub Contents API
Requires io.js or Node 0.12
npm install github-publish --save
Stable, but not feature complete
Currently missing support for deletes.
var GitHubPublisher = ;var publisher = 'token123' 'voxpelli' 'voxpelli.github.com';publisher;
- GitHubPublisher(token, username, repo) – creates a publisher object with an access token for the GitHub API, the
usernameof the owner of the repository to publish to and the name of the repository itself as
- retrieve(filename) – returns a
Promisethat resolves with either an object containing the
shaof the existing file or with
falseif no such file exists in the repository
- publish(filename, content, [options]) – publishes the specified
repoof the publisher object.
contentshould be either a
Buffer. Returns a
Promisewhich resolves to the
shaof the created object on success and to
falseon failure (failure is likely caused by a collision with a pre-existing file, as long as one haven't specified that it should be overridden).
- force – whether to replace any pre-existing file no matter what
- message – a custom commit message. Default is
- sha – the sha of an existing file that one wants to replace