Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "assert/is-gzip-buffer/docs/types/index.d"

Index

Functions

Functions

Export assignment isgzipBuffer

  • isgzipBuffer(value: any): boolean
  • Tests if a value is a gzip buffer (or Uint8Array).

    Notes

    • A gzip buffer is defined as either a Node.js Buffer or Uint8Array which contains a 10-byte header, a body containing the compressed payload, and an 8-byte footer containing a CRC-32 checksum and the length of the original uncompressed data, modulo 2^32.
    • This function only examines the 10-byte header to ensure the header includes the expected magic number and compression method. The function does not perform an integrity check.

    Parameters

    • value: any

      value to test

    Returns boolean

    boolean indicating whether a value is a gzip buffer

    Example

    var Uint8Array = require( `@stdlib/array/uint8` );
    
    var buf = new Uint8Array( 20 );
    buf[ 0 ] = 31;  // 0x1f => magic number
    buf[ 1 ] = 139; // 0x8b
    buf[ 2 ] = 8;   // 0x08 => compression method
    
    var bool = isgzipBuffer( buf );
    // returns true

    Example

    var bool = isgzipBuffer( [] );
    // returns false