Open Source

Open source software plays a big role in the products we develop. Simply put, we could not do our jobs without it! That’s why we love to contribute back to the community whenever we can. Contributions including providing bug reports to releasing code of our own. Today, we are announcing two open source libraries.

FSDoc is a Promise-based, Node.js module for simple storage and retrieval of JSON documents on the file system.

Example:

const FSDoc = require('fsdoc');

const fsdoc = new FSDoc({path: 'users'});
fsdoc.set({id: 12345, name: 'tim'})
    .then(() => {
        // stored in users/12345.json
        return fsdoc.get(12345);
    })
    .then((doc) => {
        // doc = {id: 12345, name: 'tim'}
        return fsdoc.remove(doc.id);
    });

electron-pipe is a Node.js module for Electron. It is a Promise-based wrapper around Electron’s IPC module that provides a simple API for asynchronous IPC calls that return responses.

Example:

// In Electron's main process
const pipe = require('electron-pipe');

pipe.on('get-user', (id) => {
    return db.fetch({user: id}); // db.get returns a Promise
});
// In Electron's renderer process
const pipe = require('electron-pipe');
pipe.send('get-user', 12345)
    .then((user) => {
        greet('Hello, ' + user.name);
    })
    .catch((err) => {
        // could not fetch user
    });

All of our open source projects are listed on our BitBucket page. Stay tuned for more releases in the future.

Share Comments
comments powered by Disqus