aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/upload
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-12-24 11:11:39 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-12-24 11:11:39 +0530
commitf480de0065acdccb5afafa717665fe62b3110f43 (patch)
treecde66d1c1bf0f9c352ecf0adb3b6e08eb0233c08 /plugins/upload
parentb1207d54ea6fc96fa7244aa5c0f32f264862afc6 (diff)
downloadnnn-f480de0065acdccb5afafa717665fe62b3110f43.tar.gz
Use file.io to ipload files
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 _