js-swrm-client-test

A lighweight swrm client for browser.

Usage no npm install needed!

<script type="module">
  import jsSwrmClientTest from 'https://cdn.skypack.dev/js-swrm-client-test';
</script>

README

JS-Swrm-Client

A lightweight client for peer to peer connections.

JS-Swrm-Client runs the minimal setup required to get and put data on the IPFS network.

Steps to download, install and run JS-Swrm-Client

  • Install Node.js and NPM from Browser.
  • Verify Installation.
    • Open a command prompt (or PowerShell), and enter the following:
    node –v
    
    • The system should display the Node.js version installed on your system. You can do the same for NPM:
    npm –v
    
  • To download and install packages on npm or yarn, on the command line, run the following command:
npm install js-swrm-client
yarn add js-swrm-client

You can download and run the code from https://www.npmjs.com/package/js-swrm-client

Developer Integration Guide

<script>
    var swrm = require('js-swrm-client')
    var options = {
        progress: true, 
    }

    // SWRMLabs will return an object based on the options provided. 
    Let d_event = swrm.download(link, options) 
    // options are optional, default evens will be started, completed and error
    d_event.on("started").subscribe((data) => {
      console.log("started ", data); // e,g data = { fileName : test.txt , link : nwfua76waf78bfwafafbwud , size : 1 MB  }
    });  
    
    d_event.on("progress").subscribe((data) => {
      console.log("progress ", data);
    });
    d_event.on("completed").subscribe((data) => {
      console.log("completed ", data);
    });
    d_event.on("error").subscribe((data) => {
      console.log("error ", data);
    });


</script>