immutio-client
v0.1.1
Published
Client for immut.io
Downloads
3
Maintainers
Readme
Javascript Client for immut.io
Store and retrieve arbitrary blobs from immut.io from a Node.js, io.js, or browser Javascript application.
See immut.io for more information.
Installation
With pre-published Blob:
<script type="text/javascript" src="http://immut.io/blobs/1c5e3e92-34ac-49ac-aa16-2fd79e32c6c1"></script>
<script>
var im = new Immutio();
</script>
With npm:
npm install immutio-client
With bower:
bower install immutio-client
The library can be included using CommonJS module syntax, or by including the script using the
compiled versions in /dist
.
CommonJS:
var Immutio = require('immutio-client');
var im = new Immutio();
Standalone:
<script type="text/javascript" src="dist/immutio-client.js"></script>
<script>
var im = new Immutio();
</script>
Usage
Store something
var im = new Immutio();
im.store("my random string", function (err, id) {
if(err) throw err;
console.log(id); // e.g. 43841456-f062-406b-8cdf-70ddbb736415
});
Retrieve something
var im = new Immutio();
im.retrieve("43841456-f062-406b-8cdf-70ddbb736415", function (err, str) {
if(err) throw err;
console.log(str); // e.g. my random string
});
Contributing
- Fork
- Make your changes
- Add tests
- Test and Build (
npm run build
,npm run build-tests && open test/browser.html
) - Make a pull request
TODO
- Add streams support