Skip to content
This repository has been archived by the owner on Feb 12, 2020. It is now read-only.

ipfs-shipyard/ipfs-locations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ THIS PACKAGE IS NO LONGER MAINTAINED!

ipfs-locations

npm Travis

This lets you poll locations from IPFS very easily. This is used by ipfs-stats to manage hundreds of location lookups. It looks up locations sequentially to improve the performance and avoid too many requests at once.

Install

In Node.js through npm

$ npm install --save ipfs-locations

Browser: Browserify, Webpack, other bundlers

The code published to npm that gets loaded on require is in fact an ES5 transpiled version with the right shims added. This means that you can require it and use with your favorite bundler without having to adjust asset management process.

const LocationsPoller = require('ipfs-locations')

In the Browser through <script> tag

Loading this module through a script tag will make the IpfsLocations obj available in the global namespace.

<script src="https://unpkg.com/ipfs-locations/dist/index.min.js"></script>
<!-- OR -->
<script src="https://unpkg.com/ipfs-locations/dist/index.js"></script>

API

Class LocationsPoller

new LocationsPoller(ipfs)

Methods

  • locations.get(addr) obtains the location for a certain address. It will return a Promise.
  • locations.getImmediate(addr) does the same as the previous but returns immediatelly. If there is no value in cache, returns a location with 'Unknown'.