`'ffd8' === buffer.toString('hex', 0, 2)` is more of the node way (or this module's way at least).
+
This code belongs to the jpeg check in `detector.js`
`types/*.js` files assumes that the files are valid.