Comments (4)
- I think the answer is the "most files". Some need more bytes and I figured that 10k was pretty small IO wise these days.
- When you are worried about it reading 10k. :-)
- I've added code to pay attention to fis.read() return. Thanks.
from simplemagic.
ok, then maybe we can make some kind of stream processing and if few bytes was enough then terminate the process.
Also, I'm not sure, but I guess that the size should be rounded to file system page size i.e. 4K
https://en.wikipedia.org/wiki/Page_(computer_memory)
from simplemagic.
You linked to a memory page but we are talking about IO. Most disk subsystems have page sizes a lot less than 4k – it depends highly on the underlying filesystem and IO layers. 512 bytes is often cited. I don't think it makes that much difference but I'll consider changing it to 8k.
from simplemagic.
Oh and streaming would be a big change in the code. Not a bad idea but non trivial change.
from simplemagic.
Related Issues (20)
- Problem with detecting Illustrator file HOT 4
- CMYK Jpeg files being incorrectly read with mime-type octet-stream
- RegexType reads a line for every byte in mutableOffset.offset HOT 1
- svg is not recognized HOT 1
- Doesn't recognize bitmap files exported from GIMP HOT 5
- Bash script not recognized correctly HOT 1
- Possible bug inside of MagicEntryParser HOT 4
- Slim version without internal config files HOT 2
- Support for audio/amr HOT 6
- Questions about compatibility with Android HOT 3
- bug: Weird identification of heic image file HOT 1
- Upgrade built-in magic file and use external on Linux HOT 1
- How to use external magic db? HOT 1
- AWS cloudfront image return as content type html HOT 2
- ContentInfoUtil.findMatch([77, 90]) generates NPE HOT 1
- pcapng filetype support
- .xls file shows null in return of getMimeType
- Can't read the correct content type for .xlsx files (application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
- Request: add nullable annotations, to know what can return null HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simplemagic.