DailyJS

JSON File Store, Purplecoat.js

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

libraries JSON ui database themes memory

JSON File Store, Purplecoat.js

Posted by Alex R. Young on .
Featured

libraries JSON ui database themes memory

JSON File Store, Purplecoat.js

Posted by Alex R. Young on .

JSON File Store

I've been emailed a selection of in-memory databases, spurred on by last week's LokiJS post. JSON file store (npm: jfs, License: MIT) by flosse can save JSON to files, and it also has a pretty option for producing readable output.

It can generate IDs using the node-uuid module, but it also works with custom IDs as well. It supports synchronous operations for saving and getting items. The basic usage looks like this:

var Store = require('jfs');  
var db = new Store('data');

var d = {  
  foo: 'bar'
};

// Save with custom ID
db.save('anId', d, function(err) {  
  // Now the data is stored in the file data/anId.json
});

// Save with generated ID
db.save(d, function(err, id) {  
  // id is a unique ID
});

You can toggle memory-only mode with the type: 'memory' option. I thought this project seemed like something that might be useful if you've got configuration or small data files files that are user editable, perhaps in a redistributable web application or daemon.

Purplecoat.js

Elle Kasai sent in Purplecoat.js (GitHub: ellekasai / purplecoat.js, License: MIT, Bower: purplecoat.js), a lightweight version of those popover tutorial libraries. It can be applied to an element with the data-purplecoat attribute, and data-purplecoat-label can be used to add a message.

Purplecoat.js is used to document Elle's Shiori Bootstrap theme for Jekyll, which is a clean and minimal Jekyll theme with several built-in colour themes.