GRIdded Binary or General Regularly-distributed Information in Binary file
application/x-grib
Magic Bytes
Offset: 0
47 52 49 42
General Regularly-distributed Information in Binary form (GRIB) is a standardized format developed by the World Meteorological Organization for exchanging historical and forecast weather data. It serves as the operational standard in meteorology for storing gridded fields, including temperature and wind measurements used in numerical weather prediction models. While the format is technically safe as a binary container, its compact, bit-oriented structure requires specialized decoding software and poses minimal security risks during standard processing.
Validation Code
How to validate .grb files in Python
Python
def is_grb(file_path: str) -> bool:
"""Check if file is a valid GRB by magic bytes."""
signature = bytes([0x47, 0x52, 0x49, 0x42])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .grb files in Node.js
Node.js
function isGRB(buffer: Buffer): boolean {
const signature = Buffer.from([0x47, 0x52, 0x49, 0x42]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsGRB(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/grb
curl https://filesignature.org/api/v1/grb