Unix archiver
application/octet-stream
Magic Bytes
Offset: 0
21 42 44 4E
The Unix archiver format is a file packaging standard originally developed by AT&T, designed to aggregate multiple files into a single static library container. Developers utilize this format to bundle compiled object code, enabling efficient static linking and code reuse during the software compilation process. Although native to Unix systems using a different extension, this structure is frequently encountered as `.lib` files within Windows development environments, serving as a fundamental component of legacy and modern build chains.
Validation Code
How to validate .lib files in Python
Python
def is_lib(file_path: str) -> bool:
"""Check if file is a valid LIB by magic bytes."""
signature = bytes([0x21, 0x42, 0x44, 0x4E])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .lib files in Node.js
Node.js
function isLIB(buffer: Buffer): boolean {
const signature = Buffer.from([0x21, 0x42, 0x44, 0x4E]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsLIB(data []byte) bool {
signature := []byte{0x21, 0x42, 0x44, 0x4E}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/lib
curl https://filesignature.org/api/v1/lib