GRIB

application/octet-stream

Safe

Magic Bytes

Offset: 0
47 52 49 42

GRIB (General Regularly-distributed Information in Binary form) is a standardized data format maintained by the World Meteorological Organization (WMO) for meteorological data. It serves as the primary operational standard for storing and exchanging historical and forecast weather data within scientific institutions worldwide. As a compact binary structure designed for efficient transmission of grid-based data, it is considered safe and does not support active content or executable code.

Extension

.grib

MIME Type

application/octet-stream

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .grib files in Python

Python
def is_grib(file_path: str) -> bool:
    """Check if file is a valid GRIB by magic bytes."""
    signature = bytes([0x47, 0x52, 0x49, 0x42])
    with open(file_path, "rb") as f:
        return f.read(4) == signature

How to validate .grib files in Node.js

Node.js
function isGRIB(buffer: Buffer): boolean {
  const signature = Buffer.from([0x47, 0x52, 0x49, 0x42]);
  return buffer.subarray(0, 4).equals(signature);
}
Go
func IsGRIB(data []byte) bool {
    signature := []byte{0x47, 0x52, 0x49, 0x42}
    if len(data) < 4 {
        return false
    }
    return bytes.Equal(data[:4], signature)
}

API Endpoint

GET /api/v1/grib
curl https://filesignature.org/api/v1/grib

Related Formats