←back to thread

439 points david927 | 2 comments | | HN request time: 1.582s | source

What are you working on? Any new ideas which you're thinking about?
Show context
eliseumds ◴[] No.44423042[source]
I'm dealing with mime types and max file sizes for an uploader, and improving error messages. Instead of relying on the file name to detect the mime type, I'm using the file binary header instead to reject dodgy files (for ex a `sample.jpg` file that is actually a ZIP or EXE under the hood).
replies(1): >>44423094 #
1. andai ◴[] No.44423094[source]
Are you doing

    head -c 512 file.bin | file -
replies(1): >>44423287 #
2. eliseumds ◴[] No.44423287[source]
https://github.com/sindresorhus/file-type