-
-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stdin/Stdout support for recompression, Stdout support for precompression #140
base: master
Are you sure you want to change the base?
Conversation
f26f521
to
66ab522
Compare
…rint to the console even when stdout is redirected
66ab522
to
2112c15
Compare
Hi! This is great @nicolas-comerci !! A little feedback: Could you write stats and such to stderr instead? It will be useful for scripts like this one where I give precomp a little UI I love your new version but I can't use it on my scripts as it is |
Mhhh didn't think of that use case, should be easy enough to make Also, that script looks cool, is it publicly available? |
Yes, that would be ideal, a switch to disable output altogether, or even specify a file for the log info to go, maybe
It wasn't, but not for any particular reason. I uploaded it here: https://github.com/M-Gonzalo/bash-stuff/blob/main/fancyPrecompArchiver.sh Keep in mind that it is a Linux script, and is heavy on dependencies. You're going to need:
If there are some of them you don't know about or can't get, let me know and I'll give the script a proper README with everything needed The part that's not about precomp it's built to be as fast as possible while remaining at a 7z - like ratio (usually better and at least a couple of times faster) |
@nicolas-comerci I think there's a problem with the way precomp handles file writing. |
I've tried some really huge files (including one 19.5Gb file) and didn't run into problems, though most of my testing was on windows. |
This was surprisingly easier to accomplish than I (and apparently others #55) originally suspected.
The changes on this MR are pretty much just:
fin=stdin
andfout=stdout
printf
andcout
interfere when using stdout as they also go there which would make the prints mix with the actual data, so I added aprint_to_console
function that uses putch on windows, writes directly to tty on unix/mac, which solves this problemJust added a guard to prevent reading it twice and removed the seeking as it now only reads the header when we start reading from the stream
The MR looks large because of all the changes of
printf => print_to_console
but other than that is actually pretty small.I tested this on Windows 11, Ubuntu 22 and Mac Monterrey (tho I had to do some changes on the CMake file and on some lzma header to get it to compile there, not included here) and it has worked beautifully
Tested:
EDIT: tested using -cl and -cb, fixed some minor issues, now both lzma and bzip2 precompressing to stdout and decompressing from stdin (used cat) to stdout works fine
EDIT2: got dlltest and precompf to compile on linux and mac, tested them with some files and they work okay
Please give any feedback on any improvements needed on this MR.
I think this feature will greatly improve precomp as it will make it possible to use precomp without having to deal with huge files, and have more flexibility chaining/piping precomp with external compressors/tools