webpipe
v1.0.0
Published
Harness the power of WebPipes in browser and server environments.
Downloads
18
Readme
webpipe.js
Javascript library for working with WebPipes. Use with Node.js or in the browser.
Installation
Just include the script. The webpipe
object is automagically added to your
environment. No need for new
or any other sort of initialization.
Browser
<script src="https://unpkg.com/webpipe/webpipe.min.js"></script>
Or, use a specific version by replacing x.x.x:
<script src="https://unpkg.com/[email protected]/webpipe.min.js"></script>
Node
Or, if you're using webpipe.js with node.js
$ npm [-g] install webpipe
Then require the "webpipe" module:
const webpipe = require('webpipe')
Usage
webpipe.js exposes two methods: webpipe.execute()
and webpipe.options()
. Use
webpipe.options()
to load a WebPipe's Block Definition. It can be handy while
debugging and/or learning about new WebPipes. See
examples/ for
usage examples.
webpipe.execute(url, inputs, callback)
The real workhorse is webpipe.execute()
. Use it to make a request to your
WebPipe of choice.
const url = 'https://webpip.es/calculate-square-root'
const inputs = { radicand: 9 }
webpipe.execute(url, inputs, (err, outputs) => {
if (err) {
throw new Error(err.message)
}
console.log(outputs)
})
Suggestions
All comments in how to improve this library are very welcome. Feel free post suggestions to the Issue tracker, or even better, fork the repository to implement your own ideas and submit a pull request.
License
Unless attributed otherwise, everything is under the MIT License (see LICENSE for more info).