Catalog npm
Back to packageRELEASE DETAILS

0.50.2

npm

@0xflair/react-ipfs

React components and hooks to work with IPFS. This library uses Flair's APIs to upload and pin the file to IPFS, but the file will not be stored on the backend.

Published3 Jun 2022
Direct dependencies4
Transitive dependenciesNot calculated

README

Current package documentation

Flair SDK: react-ipfs

React components and hooks to work with IPFS. This library uses Flair's APIs to upload and pin the file to IPFS, but the file will not be stored on the backend.

Getting Started

Installation

  1. Install the package:

    npm install @0xflair/react-ipfs
    
  2. Install peer dependencies:

    npm install axios
    
    # if visual components needed:
    npm install tailwindcss @headlessui/react @heroicons/react @tailwindcss/aspect-ratio
    
  3. Configure tailwind.config.js (Tailwind v3) to scan SDK for classes (if visual components needed):

    module.exports = {
      purge: [
        "./public/**/*.html",
        "./src/**/*.{js,jsx,ts,tsx,vue}",
    
        // This line tells Tailwind to look into SDK files
        "./node_modules/@0xflair/**/*.{js,jsx,ts,tsx,vue}",
      ],
      content: ["./src/**/*.{js,jsx,ts,tsx}"],
      plugins: [
        // These plugins are used in this package
        require("@tailwindcss/forms"),
        require("@tailwindcss/aspect-ratio"),
      ],
    };
    

Usage

IPFS Uploader Hook

import { useIpfsFileUploader } from "@0xflair/react-ipfs";

function App() {
  const [userFile, serUserFile] = useState<File>();
  const [{
    data: ipfsUrl,
    error: ipfsError,
    loading: ipfsLoading
  }, ipfsUpload] = useIpfsFileUploader({
    autoUpload: true,
    fromFile: userFile,
  });

  return (
    <ul>
      <li>Choose file: <input type="file" value={userFile} onChange={setUserFile} /></li>
      <li>IPFS Loading: {ipfsLoading ? 'Yes...' : 'Idle'}</li>
      <li>IPFS Error: {ipfsError?.message || ipfsError?.toString()}</li>
    </ul>
  );

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 6

Native requirements
4 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@0xflair/ipfs
Environment
{
  "local_name": "@0xflair/ipfs",
  "alias": false,
  "peer_metadata": null
}
^0.50.2runtime
@0xflair/react-common
Environment
{
  "local_name": "@0xflair/react-common",
  "alias": false,
  "peer_metadata": null
}
^0.50.2runtime
axios
Environment
{
  "local_name": "axios",
  "alias": false,
  "peer_metadata": null
}
^0.26.1runtime
@0xflair/react-common
Environment
{
  "local_name": "@0xflair/react-common",
  "alias": false,
  "peer_metadata": null
}
0.*peer
axios
Environment
{
  "local_name": "axios",
  "alias": false,
  "peer_metadata": null
}
^0.26.1peer
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^17.0.2peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-iinYaUHE6RuVn8qntfQlLCyiQ07w3Own93K/L6xkt/9xzgjaw+5OK0PyYsPkaxT2Iy1/DO2vDw5mgZ8DVa4duA==",
  "shasum": "c7278ffd30f3dec93efa8566521b28300c4a99a0",
  "tarball": "https://registry.npmjs.org/@0xflair/react-ipfs/-/react-ipfs-0.50.2.tgz",
  "fileCount": 8,
  "unpackedSize": 839776,
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEYCIQCWV5sPfwertEVqlDslTCrJqat/jVkCIWMXIrgiQwYmwgIhAJ/9qo7QEPMrDRt8AZndozK56SlMHNi4xyOQIWa601IT"
    }
  ],
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJimeYmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpiSA//S7hhi7fPXwvs2xgGu7zoV5WC1WvvaVvxdxXMLlyGngrUdr4c\r\nq/2YevpOAs8CNHhRdjbAawzlJJWNFkksX4MZnuq+i6LullKUNwnCXw8cVJJt\r\nal3Z4HwnXNVpuLeKv98XyaP5TY+elf/xuheupLO17zA5FxmJTWfXubsacL+a\r\nWx0JIoALAnaOZmFfyjfkjcgZqPHxtttjkfjP6rzLzzESUwjEAt9fPy4cVVmn\r\nUnZhVQHGrNmouVZJhPcp6W56bQFDPEommxEQbgrUbWxZOgf35WksJFpirpiD\r\noGj25YaIsPz3iumSD7HM0zL9sjpN78lCYy1U1NCzBoAb4+PdFuw0oYSh4w8p\r\nzFKGjqgRcgV7ziWNReljhTNaBI+NGDN85iWjtO8rTaF32E/Ak3kJy2bNOgBE\r\nW2uw7ejY6vKCIm0LIVWGIMkiipENATFJeiwNj+/CzvaGNm3ecHHhZhinQdOw\r\nvi6jpViUk9Ihh9AlPYT5cDKFc5bATnym+Gx6j7x/WJdQHCiT7FJxjMx13gn2\r\nx/uaoVPjVbYchi2Utu6cnaGmsc1CI6XRJ88gRmDFeit/g9WQ7RjgYHYkp40h\r\n/srSzrUovFDVVztBKsCn4egthcDeKhwYNg7dMFSLGmam+oOLV5JorkSPQ7Cg\r\nnWDZyqoIq+Z4kKM6x67MKlzcbXkotrgaVi4=\r\n=MUbF\r\n-----END PGP SIGNATURE-----\r\n"
}

Repository

PENDING
0xflair/typescript-sdk

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 23:24 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:dc06aa3a36fc84ee5bbe65bf0b2fc50206ab8cd3a711b8fd1fb563f5d0d977fc

Other collected versions

0.123.227 Nov0.123.112 Nov0.123.08 Nov0.122.228 Oct0.122.128 Oct0.122.028 OctView all collected versions →