peer-cached-api

peer-cached-api ===============

Usage no npm install needed!

<script type="module">
  import peerCachedApi from 'https://cdn.skypack.dev/peer-cached-api';
</script>

README

peer-cached-api

Let your data swarm like your users do.

Installation

npm install --save peer-cached-api

Import

var PeerCachedClient = require('peer-cached-api/client');

Usage

This library requires an external request module that uses a "request like" interface. More modern libraries can be used through polymorphic-request. Client options support Hyperdrive options.

    var client = new PeerCachedClient({ //hypercore options
        name: 'just-a-test',
        persist: false
    });
    client.requestInstance = request; //request instance
    client.request({ //request options
        uri:'http://localhost:8080/someapi',
        json: true
    }, function(err, res, body){
        //do something with the data
    });

Testing

mocha

Enjoy,

-Abbey Hawk Sparrow