Octet Stream Viewer
I have downloaded some log files from my server which I want to search for a specific string for debugging purposes. All of them have the .log extension.
Oct 22, 2013 - RPT extension file is not opening in FileNet Image Viewer eventhough i added 'application/octet-stream' in my ViewerMap. Please look into the.
The problem is that one file has the plain text document (text/plain)
mime type while the other has the Binary (application/octet-stream)
mime type.
I can open the plain text document (text/plain)
mime type log file in a text editor as plain text but the other I can't since it's in binary.
How can I view the binary .log files with application/octet-stream
mime type?
2 Answers
From this answer in What makes grep consider a file to be binary?
If there is a NUL character anywhere in the file, grep will consider it as a binary file.
There might a workaround like this cat file tr -d '000' yourgrep
to eliminate all null first, and then to search through file.
I first tried it with one file in a test directory:
And the result, a plain text document (text/plain)
text mime file.
Then since I am working with multiple files, I tried running the same command for multiple files in a directory:
And awesome, all my log files are now in a readable format!! :)
Based on your own answer, you seem to be referring specifically to searching files using grep
, rather than to changing a file's mime-type - see What is the XY problem?.
Content Type Application Octet Stream
If grep
is simply misidentifying the files based on null bytes, then you can use the -a
or --binary-files=text
options to tell grep to treat them as text regardless, as described in the manual pages:
Octet Stream Viewer
Not the answer you're looking for? Browse other questions tagged mime-typefile-type or ask your own question.
Problem Streaming PDF File to IE Browsers
Oct 18, 2006 10:29 PMkevnworkingLINK
All,
I hope someone can help me here.
Here is my problem. I put an ASP.NET (C#) application in place a few weeks ago. Everything is humming along great but then I get a call from the owner of the site telling me that the PDF files are no longer displaying. I check this and sure enough, when you click on the link that displays the PDF file, the browser seems to lock up or just go blank. What's weird is, we discovered that if you hit the refresh button on the browser the PDF file will load into the browser just as it always did. Another frustrating thing - Firefox does not have this problem. It displays the file just fine. I have rebooted the server, restarted IIS, recycled the application pool, waved dead chicken bones over the computer - all to no avail.
I stream the PDF files to the browser because they contain private information and they are not located within the web site itself. The application opens the PDF file and then streams it to the browser. Here is the code that I use:
Response.Buffer = true;
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = 'application/pdf';
Response.AddHeader('Content-Disposition', 'CIC Report');
FileStream fs;
BinaryReader br;
fs = new FileStream(documentPath, FileMode.Open);
br = new BinaryReader(fs);
Byte[] dataBytes = br.ReadBytes((int)(fs.Length - 1));
Response.BinaryWrite(dataBytes);
br.Close();
fs.Close();
I have been racking my brain on this for about five or six hours and cannot find a solution. I have double checked my code against what others are doing and it appears the same. I have even tried a different method of streaming the data down with the same results. What kills me the most is this worked for two weeks without any problem and then suddenly just stops. I have tried it from multiple machines, all with the same results.
Thanks for any help you can offer,
Kevin
FirefoxASP.NET 1.xIEASP.NETc#PDF