Google Drive Document link (.gdoc)
.gdoc file signature | application/octet-stream
Magic Bytes
Offset: 0
7B 22 75 72 6C 22 3A 20 22 68 74 74 70 73 3A 2F
Google Drive Document link
Sources: Gary Kessler
Validation Code
How to validate .gdoc files in Python
def is_gdoc(file_path: str) -> bool:
"""Check if file is a valid GDOC by magic bytes."""
signature = bytes([0x7B, 0x22, 0x75, 0x72, 0x6C, 0x22, 0x3A, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F])
with open(file_path, "rb") as f:
return f.read(16) == signature
How to validate .gdoc files in Node.js
function isGDOC(buffer: Buffer): boolean {
const signature = Buffer.from([0x7B, 0x22, 0x75, 0x72, 0x6C, 0x22, 0x3A, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F]);
return buffer.subarray(0, 16).equals(signature);
}
How to validate .gdoc files in Go
func IsGDOC(data []byte) bool {
signature := []byte{0x7B, 0x22, 0x75, 0x72, 0x6C, 0x22, 0x3A, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F}
if len(data) < 16 {
return false
}
return bytes.Equal(data[:16], signature)
}
API Endpoint
/api/v1/gdoc
curl https://filesignature.org/api/v1/gdoc
See the full API documentation for all endpoints and parameters.
Frequently Asked Questions
What is a .gdoc file?
A .gdoc file is a Google Drive Document link file. Google Drive Document link
What are the magic bytes for .gdoc files?
The magic bytes for Google Drive Document link files are 7B 22 75 72 6C 22 3A 20 22 68 74 74 70 73 3A 2F at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .gdoc file?
To validate a .gdoc file, read the first bytes of the file and compare them against the known magic bytes (7B 22 75 72 6C 22 3A 20 22 68 74 74 70 73 3A 2F) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .gdoc files?
There is no officially registered MIME type for .gdoc files. Systems typically use application/octet-stream as a generic fallback when handling this format.
Is it safe to open .gdoc files?
Google Drive Document link (.gdoc) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.