index.js 272 B

12345678910111213141516
  1. 'use strict';
  2. /**
  3. * Check if a Buffer/Uint8Array is a GZIP file
  4. *
  5. * @param {Buffer} buf
  6. * @api public
  7. */
  8. module.exports = function (buf) {
  9. if (!buf || buf.length < 3) {
  10. return false;
  11. }
  12. return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
  13. };