npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-ipfs-components

v0.2.0

Published

Vue components for fetch and display IPFS content using public gateways.

Downloads

11

Readme

Load any IPFS content from the fastest gateway available just passing a valid path.

The plugin itself verify for you the fastest suitable gateways from the Public Gateways list provided by Protocol Labs.

Once you have successfully connected to at least 3 of them, the content will show up automatically.

This component will help to fetch media from IPFS without needing to set or configure any gateway, no need for pass correct CID as parameter. It grabs the data directly from the fastest responding Gateways. In case it failed to fetch data from the gateways multiple time, this source will be removed from the list and another one will take it's place.

The service to fetch Images and JSON(Metadata) files work decoupling the URL/CID/Path passed ad check if is a valid IPFS link. In case of succeded fetch for CID and subpaths, it uses the better gateway possible to fetch content. In case of succeded feching from one of the best gateways it returns immediatelly. Otherwise it will fallback to the URL previously passed.

Live Demo / Live Demo Repo

Sources for media supported includes:

  • [x] Path with CIDv0 only: Qm...
  • [x] Path with CIDv1 only: bafy...
  • [x] IPFS protocol path: ipfs://...
  • [x] Pre-filled IPFS gateway path: https://ipfs.io/ipfs/...
  • [x] CIDv1 with subdomain path: https://bafy.../2.png
  • [x] Non IPFS URLs (Will fetch url itself.)

Installation

First install package on your project:

npm install -s vue-ipfs-components

Then use package on your Vue constructor:

import VueIPFS from 'vue-ipfs-components'

createApp(App).use(VueIPFS).mount('#app')

Usage

We feature two different components with preload:

ipfs-avatar: A component that has two different properties.

  • size: The size of the image in pixels.
  • radius: The border radius of the image.
<ipfs-avatar size="20" radius="20" src="path or cid"/>
<ipfs-avatar size="100" radius="0" src="path or cid"/>

ipfs-image: A component that has two different properties.

  • width: The width of the image in pixels.
  • height: The height of the image in pixels.
<ipfs-image width="20" height="20" src="path or cid"/>
<ipfs-image width="100" height="300" src="path or cid"/>

ipfs-video: A component that renders video tag and has two different properties.

  • width: The width of the video in pixels.
  • height: The height of the video in pixels.
  • controls: Show video controls to play/pause/mute/fullscreen
  • muted: Video muted by default (required for autoplay feature)
  • loop: Loop video
  • autoplay: Autoplay video once loaded
<ipfs-video width="20" height="20" src="path or cid"/>
<ipfs-video width="100" height="300" src="path or cid"/>

Both are extending the thid component called ipfs-media, if you want to customize an implementation, you can extend ipfs-media same way ipfs-image, ipfs-avatar and ipfs-video does with the desired modifications. ipfs-media will deal with comunication with the component core, while you just deal with how you will display the object.

References:

  • IPFS Public Fetcher Library - Repo

  • Protocol-Labs public gateway list: Website / Repo