aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/upload
blob: f74ee5c88075108819cf39614e827f4b9679d856 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env sh

# Description: Upload a file to file.io
# Requires: curl, jq, tr
# Note: File set to expire after a week
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana

if [ -s "$1" ]; then
    # Upload the file, show the download link and wait till user presses any key
    curl -s -F "file=@$1" https://file.io/?expires=1w | jq '.link' | tr -d '"'

    # To write download link to "$1".loc and exit
    # curl -s -F "file=@$1" https://file.io/?expires=1w -o `basename "$1"`.loc
else
    echo "empty file!"
fi
    read -r _