It's impossible. file(1) designed to work with pipes. You cannot use lseek(2) on pipes to get to the end of the file. Reading the entire file to the end will be very slow (and file(1) tries to be fast), and if it really reads from the pipe, it may never collide with the end of the file, which will be even worse.
In terms of documentation, in the case of open source software, the source code itself is the final documentation. If you are stuck in such a case, it is always a good idea. The file_or_fd() function in src/magic.c gives the key. Use Source, Luke !; -)
In your particular case, I would look a second time at the specified file format, and if it really cannot be analyzed using file(1) , then a short Perl or Python script trick should do the trick. Good luck
Mackie messer
source share