HDF4
application/octet-stream
Magic Bytes
Offset: 0
0E 03 13 01
Hierarchical Data Format version 4 (HDF4) is a scientific data container format originally developed by the NCSA and maintained by The HDF Group. It is primarily used to store and organize complex multidimensional arrays and raster images, serving as a standard for legacy NASA Earth Observing System missions. While largely superseded by the modern HDF5 architecture due to file size limitations, it remains supported for accessing historical scientific archives.
Validation Code
How to validate .hdf4 files in Python
Python
def is_hdf4(file_path: str) -> bool:
"""Check if file is a valid HDF4 by magic bytes."""
signature = bytes([0x0E, 0x03, 0x13, 0x01])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .hdf4 files in Node.js
Node.js
function isHDF4(buffer: Buffer): boolean {
const signature = Buffer.from([0x0E, 0x03, 0x13, 0x01]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsHDF4(data []byte) bool {
signature := []byte{0x0E, 0x03, 0x13, 0x01}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/hdf4
curl https://filesignature.org/api/v1/hdf4