npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gigo

v0.0.2

Published

Garbage-in-garbage-out: Soviet-style storage

Downloads

7

Readme

#gigo

Garbage-in-garbage-out: Soviet-style storage.

###description

gigo is a mostly key-value data store. you give it data, it will store it. gigo is "soviet-style storage" because it is very practical. it does not have a lot of bells and whistles and isn't terribly efficient or fast. it does what it says on the tin; no more, no less. in fact, gigo has only one bell or whistle, and that's its bind() method, which gives you the ability to create more complex relationships between data using simple JSON descriptor objects.

gigo is fast, because it is a node module backed by redis.

###installation

npm install gigo

###usage

##(NOTE: this readme is a work in progress and the usage examples probably don't work)

gigo just needs to be required like any module:

var gigo = require("gigo");

gigo can be used for very simple storage:

gigo.set("name", "gigo");
console.log( "name is: " + gigo.get("name") );
// name is: gigo

it's aware of different kinds of data...

var result = {
	bar: 0,
	foo: true
};
gigo.set("serialized", result);
var restored = gigo.get("serialized");
if( restored.foo === true ) {
	console.log("foo is true!");
	// foo is true!
}
gigo.remove("serialized");
console.log( typeof( gigo.get("serialized") ) );
// undefined

...but it keeps to its original promise of returning what it was given:

var send = function( client ) {
	var pic = gigo.get("pic");
	// ... send to client via HTTP response or whatever
	client.send(pic);
};
var file = function( filename ) {
	fs.readFile(filename, function(err, data) {
		if (err) return console.log(err), err;
		gigo.set("pic", data);
	});
};

gigo pays attention when you describe relationships between things:

var file = function( filename, callback ) {
	fs.readFile(filename, function(err, data) {
		return typeof( callback ) === "function" && callback( err || null, data );
	});
};
var image = {
	name: "theme.jpg",
	data: null
};
file("theme.jpg", function(err, data) {
	if (!err) {
		gigo.set("/image/theme", data, function(err, hash) {
			if (!err) {
				gigo.bind(image.data, hash);
			}
		});
	}
})

gigo can do some complex things, despite its simple nature:

var file = function( filename, callback ) {
	fs.readFile(filename, function(err, data) {
		return typeof( callback ) === "function" && callback( err || null, data );
	});	
};
var data = {
	files: ['index.html', 'site.js', 'default.css'],
	images: [],
	theme: false
};
var Image = function(filename) {
	filename: "theme.jpg",
	data: null
};

file("soundtrack.mp3", function( data ) {
	gigo.set("/presentation/theme", data);
	var 
	gigo.bind(data.theme)
});
file("background.jpg", function( data ) {
	gigo.set("/presentation/images/background", data);
});
file("logo.jpg", function( data ) {
	gigo.set("/presentation/images/logo", data);
});

###tests

gigo uses mocha and chai:

npm test

###contributors

contributions to gigo are welcome. however, changes which are mostly stylistic or semantic will not be accepted. if you submit a patch or pull request, please understand that accepting the changes may take time, at least until science invents 96-hour days.

###license

licensed under gpl v3