
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Install: npm install gistdb
This project was started just to learn the gist api.
This project is Unlicensed
create(content[,database name]); -- Create a new databse. (Requires auth) - Caller ID: 3
get(key) -- Get the value for key.
load([gist id]); -- Load a database. (No auth required) - Caller ID: 1
remove(key) -- Deletes a key and its value. Returns true or false.
save(); -- Saves a database to gist. (Requires auth) - Caller ID: 2
set(key,value); -- Sets a key with said value.
NOTE: Caller ID is used for the error lisener.
created -- Triggered by create()
Returned in object: db (database name), id (gist id)
Example: GistDB.on('created',function(obj) { console.log("Database: "+obj.db+" - ID: "+obj.id); });
loaded -- Triggered by load();
Returned in object: content (database), id (gist id)
Example: GistDB.on('loaded',function(obj) { console.log("Content: "+JSON.stringify(obj.content)); });
saved -- Triggered by save();
Returned in object: content (database), id (gist id)
Example: GistDB.on('saved',function(obj) { console.log("Content: "+JSON.stringify(obj.content)); });
error -- Triggered by create(), load(), save()
Returned in object: msg (error message), id (function caller id)
Example: GistDB.on('error',function(obj) { console.log("Error Message: "+obj.msg+" - Caller ID: "+obj.id); });
NOTE: If a listener is called without being defined, a message is sent to console.
NOTE: Username and password are not needed if you're only going to load the gist.
Changed from "user,pass,[opts]" for easy option choosing.
User - Your github user name. (optional only if loading a gist.)
Pass - Your github password. (optional only if loading a gist, required with username.)
ID - Your gist id. (optional)
Timeout - Request timeout. (optional, defaults to 10 seconds)
Example: gdb = new GistDB({user:'USERNAME',pass:'PASSWORD',id:"9cb6f8b7baa8300af0d7",timeout:1000});
var GistDB = require('gistdb');
var gdb = new GistDB({user:'USERNAME',pass:'PASSWORD',id:"9cb6f8b7baa8300af0d7",timeout:1000});
var GistDB = require('gistdb');
var gdb = new GistDB({user:'USERNAME',pass:'PASSWORD',id:"9cb6f8b7baa8300af0d7",timeout:1000});
var content = {example:'This is an example database!'};
gdb.create(content,'example.db');
gdb.on('created',function (data) {
console.log('New database created! ('+data.id+')');
init(gdb);
});
gdb.on('error',function (data) {
console.log('There was an error! (Error: '+data.msg+')');
});
gdb.on('saved',function (data) {
console.log('Content saved to database!');
});
console.log('Init called: '+gdb.get('Initcalled')); // will return false, as the DB isn't loaded.
function init (gdb) {
gdb.set('Initcalled',true);
console.log('Init called: '+gdb.get('Initcalled')); // SHOULD return true if you loaded the DB correctly.
this.save(); // Save when ever you feel like it. (probably best after adding content to the object.)
// Run your project...
};
FAQs
Use gist's from GitHub as database files.
The npm package gistdb receives a total of 0 weekly downloads. As such, gistdb popularity was classified as not popular.
We found that gistdb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.