stargaze-studio/services/upload/nft-storage.ts

9 lines
348 B
TypeScript
Raw Normal View History

import type { CIDString } from 'nft.storage'
import { NFTStorage } from 'nft.storage'
export const uploadToNftStorage = async (fileArray: File[], nftStorageApiKey: string): Promise<CIDString> => {
console.log('Uploading to NFT.Storage...')
const client = new NFTStorage({ token: nftStorageApiKey })
return client.storeDirectory(fileArray)
}