They should move those to a simple list in the README and reserve the repo for non-empty files.
Following the GitHub link (datasette-render-images) in the comment you replied to, there's a code comment with a link to the same library (small).
That is, do you need a "valid PDF" detector or "more likely a PDF than anything else" detector?
Though when I think of "detector" I think more of https://en.wikipedia.org/wiki/File_(command) and not something which verifies the file is in the correct format.
file 'setupTests.ts' setupTests.ts: Java source, ASCII text
I wouldn't put too much trust in file.
But it will work fine for PDFs, often enough.
0 regex \^import.*;$ Java source
A minimal size file could easily catch some cases where your code assumes some sort of structure (some flag, header, metadata structure, etc.) exists when it's possible it actually doesn't.
I did that here with tiny images in JPEG, PNG and GIF https://github.com/simonw/datasette-render-images/blob/maste...