| 1 | #!/usr/bin/env |
| 2 | |
| 3 | # Get the URL from the command-line argument |
| 4 | set url $argv[1] |
| 5 | |
| 6 | # Download the file using wget |
| 7 | wget -O downloaded_file $url |
| 8 | |
| 9 | # Upload the file using Pinata |
| 10 | pinata upload downloaded_file |
| 11 | |
| 12 | # Get the "bafy" value from the upload command |
| 13 | set bafy (echo $last_status | grep -o 'bafy.*') |
| 14 | |
| 15 | # Construct the IPFS URL |
| 16 | set ipfs_url "https://docs.mypinata.cloud/ipfs/"$bafy |
| 17 | |
| 18 | # Copy the IPFS URL |
| 19 | echo $ipfs_url |
| 20 | |
| 21 | # Delete the original downloaded file |
| 22 | rm downloaded_file |