time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1013B)


      1 
      2 {{alias}}( value )
      3     Tests if a value is a gzip buffer.
      4 
      5     A gzip buffer is defined as either a Node.js Buffer or Uint8Array which
      6     contains a 10-byte header, a body containing the compressed payload, and an
      7     8-byte footer containing a CRC-32 checksum and the length of the original
      8     uncompressed data, modulo 2^32.
      9 
     10     This function only examines the 10-byte header to ensure the header includes
     11     the expected magic number and compression method. The function does not
     12     perform an integrity check.
     13 
     14     Parameters
     15     ----------
     16     value: any
     17         Value to test.
     18 
     19     Returns
     20     -------
     21     bool: boolean
     22         Boolean indicating whether value is a gzip buffer.
     23 
     24     Examples
     25     --------
     26     > var buf = new {{alias:@stdlib/array/uint8}}( 20 );
     27     > buf[ 0 ] = 31;  // 0x1f => magic number
     28     > buf[ 1 ] = 139; // 0x8b
     29     > buf[ 2 ] = 8;   // 0x08 => compression method
     30     > var bool = {{alias}}( buf )
     31     true
     32     > bool = {{alias}}( [] )
     33     false
     34 
     35     See Also
     36     --------
     37