Last active
March 6, 2024 09:49
-
-
Save kmmndr/d461cb396a1dfccd9f33e9e8422f5ec5 to your computer and use it in GitHub Desktop.
Serve file using bore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -u | |
file=$1 | |
port=9999 | |
bore local ${port} --to bore.pub & | |
bore_pid=$! | |
{ echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c <${file})\r\n\r\n"; cat ${file}; read; } | nc -l -p ${port} | |
kill $bore_pid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
macOS requirements