Skip to content

Allows you to programmatically post/get/update json data online, easily and for free.

Notifications You must be signed in to change notification settings

matthieu-rolland/cloudjson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLOUDJSON

Build Status alt npm

cloudjson is a simple module that allows you to programmatically post/get/update json data online, using the api of a free service called MyJson.

Why would I need this?

This module is useful if you need to quickly store json data online, for a proof of concept project, or any not so long term project that must be done fast.

Usage

Post data

const cloudJson = require('cloudjson');
var jsonData = {'foo' : 'bar', 'foo2' : 'bar2'};

// post json online (will return the url from which you'll be able to fetch your data)
cloudjson.post(jsonData).then(function(result){
	// result contains the url
});

// optionnaly, you can specify a password to encrypt the data you push online
var password = 'myPassword';
cloudjson.post(jsonData, password).then(function(result){
	// result contains the url
});

From here, examples will be shown using async/await instead of 'then', implying that you are inside an async function, all methods can be used in both manners, since they all return a promise.

Fetch Data

// to fetch data you've precedently posted, you need the previously given url
var myData = await cloudjson.get(jsonUrl);

// if you encrypted the data when you posted it, specify its password to decrypt it:
var myData = await cloudjson.get(jsonUrl, password);

Update data

// to update data, you need the url of the previously created json
var updatedData = await cloudjson.update(newJsonData, jsonUrl);

// if your json was encrypted, specify the password
var updatedData = await cloudjson.update(newJsonData, jsonUrl, password);

About

Allows you to programmatically post/get/update json data online, easily and for free.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published