From f480de0065acdccb5afafa717665fe62b3110f43 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Tue, 24 Dec 2019 11:11:39 +0530 Subject: Use file.io to ipload files --- plugins/upload | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 plugins/upload (limited to 'plugins/upload') diff --git a/plugins/upload b/plugins/upload new file mode 100755 index 0000000..f74ee5c --- /dev/null +++ b/plugins/upload @@ -0,0 +1,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 _ -- cgit v1.2.3-70-g09d2