0.0.1-4 • Published 2 years ago
@uniblock/nft.storage v0.0.1-4
@uniblock/nft.storage
Overview
This package is wrapper around nft.storage. @uniblock/nft.storage allows developers to pin files to IPFS using nft.storage. IPFS is a distributed system for storing and accessing files, websites, applications, and data. A common use-case might be to store a image and it's metadata to IPFS to create NFTs
Installation
Add the SDK to your project to get started
npm i @uniblock/nft.storage
or
yarn add @uniblock/nft.storage
Initialization
To instantiate the @uniblock/nft.storage object we just call the initialize function and pass in our uniblock api key as an argument
import { initializeNFTStorage } from '@uniblock/nft.storage';
const client = await initializeNFTStorage(UNIBLOCK_API_KEY);
Once we have the object, we can call methods on it
StoreBlob
This method uploads a file to IPFS
const hash = await client.storeBlob(blob);
StoreDirectory
This method allows users to upload multiple files, in a directory structure
const hash = await client.storeDirectory(directory);