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

@fazio/ipfs-upload-button

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fazio/ipfs-upload-button

Customisable HTML Web Component button to upload files to IPFS

  • 0.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

@fazio/ipfs-upload-button

Customable Web Component button to upload files to IPFS.

Usage & Installation

  • install NPM package npm install @fazio/ipfs-upload-button
  • import the component in your project import '@fazio/ipfs-upload-button'
  • create APIKEY on Web3Storage.
  • add the component to your HTML page
    <web3-upload-btn token="YOUR_WEB3STORAGE_APIKEY">
      Upload to IPFS
    </web3-upload-btn>
    

Attributes

You can use the following attribut to toggle the component behavior:

  • token - required - Your IPFS provider APIKEY or JWT (see Configuration).
  • isdisplayresult - optional - Display the result of the upload in the DOM. Default value is false.

Customization Style

You can customize the component style by using the following CSS-Parts:

  • btn - The button element
  • spinner - The spinner element
  • result - The results display element

Example:

  web3-upload-btn::part(btn) {
    background-color: rgb(0, 162, 255);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
  }

Handle Events

You can handle the following events from the component:

  • progress - The upload progress event. The event detail is the upload progress in percentage.
  • success - The upload success event. The event detail is the upload result.
  • error - The upload error event. The event detail is the error message.

Example:

const btn = document.querySelector('web3-upload-btn')
btn.addEventListener('success', (e) => {
  console.log('Result: ', e.detail);
});

FAQs

Package last updated on 28 Nov 2022

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