noahra / byteblitz

A CLI-tool for viewing the binary content of files.
GNU General Public License v3.0
24 stars 0 forks source link

Process redirected input as a file #62

Open arthurbacci opened 7 months ago

arthurbacci commented 7 months ago

The command curl https://idk/a.tar.gz | byteblitz a.tar.gz should firstly check if a.tar.gz exists. If it does, exit with an error, otherwise, write the input to the file and open it normally. Since stdin is now curl's output, for the user to be able to edit the file, the program needs to open the input of the terminal. This can be done by opening /dev/tty (since SUSv1). Checking if the input is a pipe can be done with this trait from rust's std.

Also, it should behave correctly when used alongside #15, as in curl https://idk/a.tar.gz | byteblitz hex /tmp/deletelater.tar.gz > hexadecimal.txt.