Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
133 lines (90 sloc) 3.31 KB


ngist is a node.js module and CLI tool for easy posting of gists.


With npm:

npm install ngist

Clone this project:

git clone


Usage: ngist [file.js file2.js ...] [options]

-h, --help         Display this help page
-c, --clip         Use clipboard content
                     ex: ngist [file.js] -c file.js
-d, --desc         Set description of gist
                     ex: ngist file.js -d 'Description'
-u, --user         Github username
-t, --token        Github API token
                     ex: ngist file.js -u username -t token
-p, --private      Make gist private
-o, --out          Copy gist url to clipboard

How to set user/token with git config

Once you get your Github API token from your Github Account If you set your Github username and API token using these steps, ngist will automatically gather them and authenticate for you.

Run these two commands:

git config --add github.user [github_username]
git config --add github.token [github_api_token]

To verify that they have been set, use:

git config --get github.user
git config --get github.token


The ngist module is simple and easy to use.



var ngist = require('ngist');

var files = [{
	name: 'file1.js', 
	contents: "function(){ console.log('x'); };"
}, {
	name: 'file2.js', 
	contents: "function(){ test.x; };"
var options = {
	user: "chapel", // Your username!
	token: "asa09fjew0f", // Github API Token
	description: 'This is an example gist', // Set for whole gist and is optional.
	private: true; // Set to true if you want the gist to be private, otherwise omit.

ngist.send(files, options, function(err, url) {
	console.log(url); // Example:


var ngist = require('ngist');

var files = ['file1.js', 'file2.js'];
var options = {
	user: "chapel", 
	token: "asa09fjew0f", 
	description: 'This is an example gist', 
	private: true; 

ngist.files(files, function(err, processed_files) {
	ngist.send(processed_files, options, function(err, url) {

ngist = require 'ngist'

files = ['file1.js', 'file2.js']
options = 
	user: "chapel"
	token: "pajsdfjoafe"
	description: 'This is an example gist'
	private: true;
ngist.files files, (err, processed_files) ->
	ngist.send processed_files, options, (err, url) ->
		console.log url



Takes an array of file names, fetches the files, while sending an error if a file is not found. If all files are found, then it returns an array of objects that have the files extension, name, and contents ready to be sent.


Takes an array of objects, as well as an object that has optional parameters like user/token, description and private. If there are no errors, it will return a gist url.

Inspired By

The original CLI tool was inspired by defunkt's gist as well as those on #node.js that gave advice and criticism. It is always welcome.