Use file.io to ipload files

This commit is contained in:
Arun Prakash Jana 2019-12-24 11:11:39 +05:30
parent b1207d54ea
commit f480de0065
No known key found for this signature in database
GPG Key ID: A75979F35C080412
3 changed files with 20 additions and 17 deletions

View File

@ -52,10 +52,10 @@ Plugins extend the capabilities of `nnn`. They are _executable_ scripts (or bina
| ringtone | Create a variable bitrate mp3 ringtone from file | sh | date, ffmpeg |
| splitjoin | Split file or join selection | sh | split, cat |
| suedit | Edit file using superuser permissions | sh | sudoedit/sudo/doas |
| transfer | Upload file to transfer.sh | sh | curl |
| treeview | Informative tree output in `$EDITOR` | sh | tree |
| uidgid | List user and group of all files in dir | sh | ls, less |
| upgrade | Upgrade nnn manually on Debian 9 Stretch | sh | curl |
| upload | Upload file to file.io | sh | curl, jq, tr |
| vidthumb | Show video thumbnails in terminal | sh | [ffmpegthumbnailer](https://github.com/dirkvdb/ffmpegthumbnailer),<br>[lsix](https://github.com/hackerb9/lsix) |
| wall | Set wallpaper or change colorscheme | sh | nitrogen/pywal |

View File

@ -1,16 +0,0 @@
#!/usr/bin/env sh
# Description: Upload a file to transfer.sh
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
if ! [ -z "$1" ]; then
# Upload the file, show the download link and wait till user presses any key
curl -s --upload-file "$1" https://transfer.sh/"$(basename "$1")"
echo
read -r _
# To write download link to "$1".loc and exit
# curl -s --upload-file "$1" https://transfer.sh/`basename "$1"` -o `basename "$1"`.loc
fi

19
plugins/upload Executable file
View File

@ -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 _