Skip to content

Instantly share code, notes, and snippets.

@maximousblk
Last active February 11, 2022 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maximousblk/b4bd89935418b77f94f7163f3941ccae to your computer and use it in GitHub Desktop.
Save maximousblk/b4bd89935418b77f94f7163f3941ccae to your computer and use it in GitHub Desktop.
one liner to upload files to IPFS

Upload Files to IPFS

one liner to upload files to IPFS

Quick Use

curl -fsSL https://gist.new/raw/b4bd89935418b77f94f7163f3941ccae/upload.sh | bash -s -- file.txt image.png [...]

Install

curl -fsSL https://gist.new/raw/b4bd89935418b77f94f7163f3941ccae/upload.sh > ~/bin/ipfsadd
chmod +x ~/bin/ipfsadd

ipfsadd file.txt image.png [...]
imgupload() {
curl 'https://ipfs.infura.io:5001/api/v0/add?pin=true&cid-version=1' \
-F "path=@$1" --compressed --silent |
jq -r '.Hash'
}
for file in "$@"; do
echo "https://gateway.ipfs.io/ipfs/$(imgupload $file)"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment