aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/upload
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/upload')
-rwxr-xr-xplugins/upload19
1 files changed, 19 insertions, 0 deletions
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 _