file.io.sh 567 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. #==========================================
  3. # 100 uploads per day, 5GB file size limit for FREE plan.
  4. #==========================================
  5. URL="https://file.io"
  6. DEFAULT_EXPIRE="14d" # Default to 14 days
  7. if [ $# -eq 0 ]; then
  8. echo "Usage: file.io FILE [DURATION]\n"
  9. echo "Example: file.io path/to/my/file 1w\n"
  10. exit 1
  11. fi
  12. FILE=$1
  13. EXPIRE=${2:-$DEFAULT_EXPIRE}
  14. if [ ! -f "$FILE" ]; then
  15. echo "File ${FILE} not found"
  16. exit 1
  17. fi
  18. RESPONSE=$(curl -# -F "file=@${FILE}" "${URL}/?expires=${EXPIRE}")
  19. echo "${RESPONSE}" # to terminal