{"_id":"@eddiewang/sia.js","_rev":"1-4dfede0b52bf73bd088da280584d29a8","name":"@eddiewang/sia.js","dist-tags":{"latest":"0.4.4"},"versions":{"0.4.4":{"name":"@eddiewang/sia.js","version":"0.4.4","description":"Node wrapper for siad of the Sia network","main":"lib/sia.js","scripts":{"build":"babel -d lib/ src/","test":"npm run lint && mocha --compilers js:babel-register --recursive ./test","prepublish":"npm run build","lint":"eslint --max-warnings 0 ./src ./test","kill":"killall siad; while pgrep siad; do sleep .5; done;","clean":"npm run kill && rm -rf Sia node_modules"},"keywords":["Sia","Sia-UI","Decentralized","Cloud","Storage","Altcoin","Cryptocurrency"],"bugs":{"url":"https://github.com/NebulousLabs/Nodejs-Sia/issues"},"author":{"name":"Nebulous Labs"},"license":"MIT","devDependencies":{"babel-cli":"^6.10.1","babel-eslint":"^8.0.0","babel-plugin-transform-runtime":"^6.9.0","babel-polyfill":"^6.9.1","babel-preset-es2015":"^6.9.0","babel-preset-stage-3":"^6.11.0","babel-register":"^6.18.0","babel-runtime":"^6.18.0","chai":"^4.1.2","eslint":"4.7.2","mocha":"^3.5.3","nock":"^9.0.18","proxyquire":"^1.7.10","readdir":"0.0.13","sinon":"^3.3.0"},"dependencies":{"bignumber.js":"7.2.1","request":"^2.81.0"},"gitHead":"ae80288a1eff242b82077f8e71b9ad2d5fa2e99c","_id":"@eddiewang/sia.js@0.4.4","_npmVersion":"6.1.0","_nodeVersion":"8.11.1","_npmUser":{"name":"eddiewang","email":"bonjour@eddiewang.me"},"dist":{"integrity":"sha512-WnhePKdIBLSQPmtz2++Kr8kbBi3EfY4RuGWmA6Nj3djzcaE23YASVdjpcSSdHZhNp6ogTGQcnW5+5l6l4NhvrA==","shasum":"04d1a6186446fb6f55fdf0da61a4cefd2cc27c9b","tarball":"https://registry.npmjs.org/@eddiewang/sia.js/-/sia.js-0.4.4.tgz","fileCount":10,"unpackedSize":175886,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcbufOCRA9TVsSAnZWagAA0rQP/0hn9cbitHFngBJAkJUw\nEMciun+lngm1qTcG+wsBPyH8mHK4FmFxWcUZydGAx0OIgMgoMhbxmgT3ORJq\nBJlHHHoQmXwUAo7kuxoMw4QxKwJAnvEXLex9nUY/U55UqaDvYvPOzJOH+mwn\nQIA2v1CKrKBrRHTGHTqJbN5GaXq1LUFGgdVN+kv3MLYLwI6hnFhr7Vx3xaqi\n0sOjV+7anKyn9obKqKYiRoEWYpNJBw494akFo6ijXEY4ijMTXgJAZfi00lZl\nAgepD9UGeDYt2g3gG892jq5BRtKAyp+naxNpE0j5do0CN2ZySCSfWnRfNOQ2\nRT88f/SjOZS2/oPdYMCwU+CCRfbNXZchDFd0ql56HBNlcYCmZAiE6EBW3dFE\ngdUL/PdbEwxB5H1c9ES/DcgoknwnsW3/8vnKw1ki6+QjXqpXa4jiPr6vNQUi\nGLB1S84dWeFGr+Os5diC4lNxB4fYv6qRbGU7/od6J7AyNAl4gFfRi0HwJSx8\nxgjrnjURM0Tk+U+C282JSG6FAjLNGWWZUAml5KJBPiyOYUDqbpdxqPLZ+raP\nyLpfhteBxBG0nY7yfmwYf18WlcKfRAu8yOCKY6f5w3EgDm/0Wj+F1ly6cYSe\nk4vMU07VkisCufnNYy1rDImZwv0QmPUjYZIc7WHJq8VwrJcE8nS4nGd//pOz\nRKTz\r\n=7mMA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSeaGERzzab7v763F5UBrXatnSuGpCauN+IVBZoajqcQIgeyrL/Qtj+/Hd+wI8KC7tnem5wENkaKpjV1yt+uP2AdI="}]},"maintainers":[{"name":"eddiewang","email":"bonjour@eddiewang.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sia.js_0.4.4_1550772174102_0.3615430591024358"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-21T18:02:53.920Z","0.4.4":"2019-02-21T18:02:54.322Z","modified":"2022-04-05T06:41:01.596Z"},"maintainers":[{"name":"eddiewang","email":"bonjour@eddiewang.me"}],"description":"Node wrapper for siad of the Sia network","keywords":["Sia","Sia-UI","Decentralized","Cloud","Storage","Altcoin","Cryptocurrency"],"author":{"name":"Nebulous Labs"},"bugs":{"url":"https://github.com/NebulousLabs/Nodejs-Sia/issues"},"license":"MIT","readme":"# [![Sia Logo](http://sia.tech/img/svg/sia-green-logo.svg)](http://sia.tech/) Nodejs Wrapper\n\n[![Build Status](https://travis-ci.org/NebulousLabs/Nodejs-Sia.svg?branch=master)](https://travis-ci.org/NebulousLabs/Nodejs-Sia)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n[![devDependency Status](https://david-dm.org/NebulousLabs/Nodejs-Sia/dev-status.svg)](https://david-dm.org/NebulousLabs/Nodejs-Sia#info=devDependencies)\n[![dependencies Status](https://david-dm.org/NebulousLabs/Nodejs-Sia.svg)](https://david-dm.org/NebulousLabs/Nodejs-Sia#info=dependencies)\n[![license:mit](https://img.shields.io/badge/license-mit-blue.svg)](https://opensource.org/licenses/MIT)\n\n# A Highly Efficient Decentralized Storage Network\n\nThis is a [Nodejs](https://nodejs.org/) wrapper for\n[Sia](https://github.com/NebulousLabs/Sia). Use it in your apps to easily\ninteract with the Sia storage network via function calls instead of manual http\nrequests.\n\n## Prerequisites\n\n- [node & npm (version 5.9.0+ recommended)](https://nodejs.org/download/)\n\n## Installation\n\n```\nnpm install sia.js\n```\n\n## Example Usage\n\n```js\nimport { connect } from 'sia.js'\n\n// Using promises...\n// connect to an already running Sia daemon on localhost:9980 and print its version\nconnect('localhost:9980')\n  .then((siad) => {\n    siad.call('/daemon/version').then((version) => console.log(version))\n  })\n  .catch((err) => {\n    console.error(err)\n  })\n\n// Or ES7 async/await\nasync function getVersion() {\n  try {\n    const siad = await connect('localhost:9980')\n    const version = await siad.call('/daemon/version')\n    console.log('Siad has version: ' + version)\n  } catch (e) {\n    console.error(e)\n  }\n}\n\n```\nYou can also forgo using `connect` and use `call` directly by providing an API address as the first parameter:\n\n```js\nimport { call } from 'sia.js'\n\nasync function getVersion(address) {\n  try {\n    const version = await call(address, '/daemon/version')\n    return version\n  } catch (e) {\n    console.error('error getting ' + address + ' version: ' + e.toString())\n  }\n}\n\nconsole.log(getVersion('10.0.0.1:9980'))\n```\n\n`sia.js` can also launch a siad instance given a path on disk to the `siad` binary.  `launch` takes an object defining the flags to use as its second argument, and returns the `child_process` object.  You are responsible for keeping track of the state of this `child_process` object, and catching any errors `launch` may throw.\n\n```js\nimport { launch } from 'sia.js'\n\ntry {\n  // Flags are passed in as an object in the second argument to `launch`.\n  // if no flags are passed, the default flags will be used.\n  const siadProcess = launch('/path/to/your/siad', {\n    'modules': 'cghmrtw',\n    'profile': true,\n  })\n  // siadProcess is a ChildProcess class.  See https://nodejs.org/api/child_process.html#child_process_class_childprocess for more information on what you can do with it.\n  siadProcess.on('error', (err) => console.log('siad encountered an error ' + err))\n} catch (e) {\n  console.error('error launching siad: ' + e.toString())\n}\n```\n\nThe call object passed as the first argument into call() are funneled directly\ninto the [`request`](https://github.com/request/request) library, so checkout\n[their options](https://github.com/request/request#requestoptions-callback) to\nsee how to access the full functionality of [Sia's\nAPI](https://github.com/NebulousLabs/Sia/blob/master/doc/API.md)\n\n```js\nSiad.call({\n  url: '/consensus/block',\n  method: 'GET',\n  qs: {\n    height: 0\n  }\n})\n```\n\nShould log something like:\n\n```bash\nnull { block:\n { parentid: '0000000000000000000000000000000000000000000000000000000000000000',\n   nonce: [ 0, 0, 0, 0, 0, 0, 0, 0 ],\n   timestamp: 1433600000,\n   minerpayouts: null,\n   transactions: [ [Object] ] } }\n```\n","readmeFilename":"README.md"}