Last active
June 11, 2022 01:54
-
-
Save torresnova/6a7e82f8d25486107e0dbcd9fdbd6e1f to your computer and use it in GitHub Desktop.
Upload something to IPFS using JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ipfsClient = require("ipfs-http-client"); | |
const ipfs = ipfsClient.create({ | |
host: "ipfs.infura.io", | |
port: 5001, | |
protocol: "https", | |
}); | |
const item = { | |
// describe something | |
} | |
await ipfs.add(item).then(async (res) => { | |
console.log(res) /// true | |
}).catch((err) => console.error(err)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment