Skip to content

Instantly share code, notes, and snippets.

@torresnova
Last active June 11, 2022 01:54
Show Gist options
  • Save torresnova/6a7e82f8d25486107e0dbcd9fdbd6e1f to your computer and use it in GitHub Desktop.
Save torresnova/6a7e82f8d25486107e0dbcd9fdbd6e1f to your computer and use it in GitHub Desktop.
Upload something to IPFS using JS
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