[Feature] Read in from stdin/pipe #153

Open
opened 2026-01-19 18:29:12 +00:00 by michael · 4 comments
Owner

Originally created by @corneliusroemer on GitHub.

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;}
Originally created by @corneliusroemer on GitHub. 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;} ```
michael added the hacktoberfest label 2026-01-19 18:29:12 +00:00
Author
Owner

@paolafrancesca commented on GitHub:

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

@paolafrancesca commented on GitHub: @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?
Author
Owner

@corneliusroemer commented on GitHub:

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.

@corneliusroemer commented on GitHub: 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.
Author
Owner

@anihm136 commented on GitHub:

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 commented on GitHub: 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
Author
Owner

@paolafrancesca commented on GitHub:

@anihm136 you probably want to send a PR for changing https://github.com/dutchcoders/transfer.sh-web/blob/master/src/index.html#L165

@paolafrancesca commented on GitHub: @anihm136 you probably want to send a PR for changing https://github.com/dutchcoders/transfer.sh-web/blob/master/src/index.html#L165
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dutchcoders/transfer.sh#153