-
Notifications
You must be signed in to change notification settings - Fork 18
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
Skip binaries files on filesystem scan #201
Comments
Hi, I was thinking of tackling this one using this library. What do you think? |
@nargov from their documentation:
I don't want to harm our performance, this library at least makes us read each file twice. I'm looking for an idea to reduce the binaries scans, but without huge performance issues on one hand, and without doing magics for the user on the other hand. What do you think?By the way, I'm sorry for the late response, I was sick. I appreciate your help! |
As an alternative, I see https://pkg.go.dev/net/http#DetectContentType reads at most 512 bytes to detect the MIME type. Think it's good enough? |
OK, I think we can create a POC for that. Here is what I'm thinking:
You don't have to answer all the questions before you start developing. |
Another option will be to ignore lines that are too long. On one hand, they might be a binary file. But on the other hand, they can be a minified JS file. |
Steps to reproduce:
go build -o 2ms main.go
filesystem
scan with./2ms filesystem --path . --log-level debug
./2ms
executable itself.There are two problems here:
The text was updated successfully, but these errors were encountered: