transfer.sh
transfer.sh copied to clipboard
[Feature] Read in from stdin/pipe
I'm using the transfer.sh script linked on the website. Would it be possible to extend this script so that I can pipe input into it, rather than having to specify an existing file?
transfer(){ if [ $# -eq 0 ];then echo "No arguments specified.\nUsage:\n transfer <file|directory>\n ... | transfer <file_name>">&2;return 1;fi;if tty -s;then file="$1";file_name=$(basename "$file");if [ ! -e "$file" ];then echo "$file: No such file or directory">&2;return 1;fi;if [ -d "$file" ];then file_name="$file_name.zip" ,;(cd "$file"&&zip -r -q - .)|curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/null,;else cat "$file"|curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/null;fi;else file_name=$1;curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/null;fi;}
@corneliusroemer it's feasible but we still would need a filename for the upload
it could be generated randomly as well, what's your proposed solution for this?
Random name is perfectly fine in this case, what else should it be :) could of course be passed as a command line argument as extra feature as add on.
Hi! I've modified the script from the website to accept input from STDIN. Where would you like me to share it? I noticed that there is a separate repository for the web frontend, where the script is currently located
@anihm136 you probably want to send a PR for changing https://github.com/dutchcoders/transfer.sh-web/blob/master/src/index.html#L165