在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:dabit3/ipfs-pinata-example开源软件地址:https://github.com/dabit3/ipfs-pinata-example开源编程语言:开源软件介绍:An example of how to pin a file to IPFS with Pinata in a JavaScript appIf you're like me and had no luck finding any examples or code to show how this is done, then hopefully this will help you. Pinning a stringasync function save() {
let ipfs = await IPFS.create({
url: "https://api.pinata.cloud/psa",
repo: 'file-path' + Math.random()
})
const { cid } = await ipfs.add('hello world')
const url = `https://gateway.pinata.cloud/ipfs/${cid.string}`
console.log(url)
} Pinning a fileasync function onChange(e) {
const file = e.target.files[0]
let ipfs = await IPFS.create({
url: "https://api.pinata.cloud/psa",
repo: 'file-path' + Math.random()
})
const { cid } = await ipfs.add(file)
const url = `https://gateway.pinata.cloud/ipfs/${cid.string}`
console.log(url)
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论