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
andNPM
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 = { dst: "/home/ynkumar/Downloads", 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',(data)=>{}) // e,g data = { fileName : test.txt , link : nwfua76waf78bfwafafbwud , size : 1 MB } d_event.on('progress',(data)=>{// e.g data = { percentage: 34.67, bytesReceived : 456789 , elapsedTime : 150000 } Console.log(‘Download Progress ‘,data.percentage); Console.log(‘ Bytes Received ‘,data.bytesReceived); Console.log(‘Elapsed Time‘,data.elapsedTime); }) d_event.on('completed',()=>{}) d_event.on('error',(err)=>{}) </script>