gist-db

Treat your gist account like a database

Gist-DB

Treat your gist account like a database. Powered by TaffyDB and Github.

npm install gist-db
var config = {
    github:{
        username:"mcwhittemore"
    }
}

var GISTDB = require("gist-db");

var _db = GISTDB(config);

_db.event.on('refreshing', function(){
  //MIGHT WANT TO LOCK DOWN THINGS FOR A BIT
  console.log("LETS DO THIS");
});

_db.event.on('refreshed', function(err){
  _db().each(function(file){
    console.log(file);
  });
});
{
    id = gist_id+"_"+filename,
    gist_id = gist_id,
    error: undefined,
    raw: "THE RAW VALUE OF THE FILE",
    type: "mime type",
    language: "language the file is written in",
    raw_url: "https path to the raw text version of the file",
    size: numeric size of the file
}

Please refer to the [TaffyDB docs][http://www.taffydb.com/workingwithdata] for more details

Create a new gist-db.

Parameters

config: settings. Required to at least pass {github:{username:"SOME_USER_NAME"}} fileInit: function(file). A function that returns the file obj if it should be added to the DB and undefined if it should be excluded.

  • TaffyDB: Yes
  • Returns: All rows that meet the passed criteria. Not passing an object, will return all rows.

Inserts records into the database.

  • TaffyDB: Yes
  • Returns: A query pointing to the inserted records

Full use of the github module passed the github subsection of your config file.

An implementation of require("events").EventEmitter

Use to be notified when gist-db is connecting gist for a refresh.

Use to be notified when gist-db is done its current refresh. If err is set, this refresh was ended due to error.

Use to be notified of errors in gathering data on the gist files.

Parameters

err: The error object that triggered this event file: The file object that was being gathered when the error occurred

Use to be notified of errors when connecting with github.

Parameters

err: the github module error object that triggered this event res: The github module response object. Might contain good data about the error.

  • Add private gist gathering
  • Add local file loading
  • Add local file saving
  • Add Update gist.github
  • Add Insert gist.github
  • Add Delete gist.github

All code not otherwise specified is Copyright 2013 Matthew Chase Whittemore and is released under the MIT License.

All code found in the node_modules directory is Copyrighted by its creators. Please see each module for further details.