json 我们是否可以使用web3storage或www.example.com在ipfs上存储类似“Hello world”的字符串nft.storage

dced5bon  于 2022-11-26  发布在  其他
关注(0)|答案(1)|浏览(78)

我试图将加密字符串存储在www.example.com上nft.storage,但遇到以下错误,

Uncaught (in promise) TypeError: source is not async iterable
    at last (index.js:13:1)
    at pack (index.js:14:1)
    at packCar (lib.js:757:1)
    at NFTStorage.encodeBlob (lib.js:472:1)
    at NFTStorage.storeBlob (lib.js:151:1)
    at NFTStorage.storeBlob (lib.js:542:1)
    at storeAsset (Results.jsx:41:1)
    at encryptingData (Results.jsx:71:1)

我试过的是,
第一次

nwsw7zdq

nwsw7zdq1#

import { Web3Storage } from "web3.storage"; 

const token = process.env.NEXT_PUBLIC_TOKEN; 
  
 function makeStorageClient() { 
   return new Web3Storage({ token }); 
 } 
  
 function makeFileObjects(text) { 
   const obj = { email: text }; 
   const blob = new Blob([JSON.stringify(obj)], { type: "application/json" }); 
   const files = [new File([blob], "email.json")]; 
   return files; 
 }

相关问题