vientorepublic/buffer-analysis-engine ? reverse-engineered prompt

Reverse engineered prompt

Build me a small TypeScript library that can inspect a Buffer or stream and tell me what kind of file it probably is, using magic bytes, and also flag suspicious content like script tags, SQL injection style text, shell commands, and path traversal patterns.

I want it to be lightweight and dependency free, with a simple API I can use on one buffer or through a reusable engine. Please include a global helper too, plus a way to reset it for tests or reconfiguration. It should support adding and removing custom file signatures at runtime, and let me get suspicious patterns by category.

Also add stream support so I can analyze files without loading everything into memory, and include small Express and Koa middleware helpers that attach the analysis result to the request. Please make the defaults sensible, let me limit how much of a file gets scanned, and skip very large files if needed. Include good tests and a README with examples. If you need to check current Node or TypeScript docs, look them up online.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab