New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ilp-fetch

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ilp-fetch

> Simple paid HTTP request library for Interledger. Based on [node-fetch](https://www.npmjs.com/package/node-fetch).

  • 1.4.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

ILP Fetch

Simple paid HTTP request library for Interledger. Based on node-fetch.

Usage

The ILP Fetch API supports all the options that are present in the node-fetch API.

Two additional fields are added:

  • plugin: The ILP plugin used to make payments.
  • maxPrice: The maximum, in the plugin's base units, which ILP fetch will send.

Example

The below example will upload a file containing hello world to Unhash (content-addressed storage on top of ILP).

const plugin = require('ilp-plugin')()
const fetch = require('.')

fetch('https://alpha.unhash.io', {
  plugin,
  maxPrice: 100,
  method: 'POST',
  body: 'hello world'
})
  .then(r => r.json())
  .then(json => {
    console.log('json response:', json)
    process.exit(0)
  })
  .catch(e => {
    console.error(e)
    process.exit(1)
  })

Test

First run Moneyd on your machine. Then:

git clone https://github.com/interledgerjs/ilp-fetch.git
cd ilp-fetch
npm install
DEBUG=* node test.js

In the Browser

Because ILP fetch is based around Fetch, it is possible for it to run in the browser. Because of the restricted use of headers and cross-origin requests (and because it is not possible to access moneyd from within a webpage), it may not be useful in an ordinary webpage.

However, in the evironment of an extension it can be useful to make payment-enabled requests. Additionally, an extension should have no problems making cross-origin requests or accessing moneyd.

Just add the following block to your webpack config:

  externals: {
    'node-fetch': 'fetch'
  }

FAQs

Package last updated on 03 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc