Skip to content

Google Drive Document link magic bytes (.gdoc)

.gdoc file signature: 7B 22 75 72 6C 22 3A 20 22 68 74 74 70 73 3A 2F | application/octet-stream

Google Drive Document link (gdoc) is a shortcut file format created and maintained by Google to point to an online Google Docs document. It is commonly used for desktop shortcuts, shared document references, and synchronized access from file managers or backup tools. Because it contains only a reference to a remote document, the file is generally safe, but users should verify the target source before opening shared links.

Safe

Magic Bytes

Offset 0
7B 22 75 72 6C 22 3A 20 22 68 74 74 70 73 3A 2F

Sources: Gary Kessler

Validation Code

How to validate .gdoc files in Python

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

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

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

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

See the full API documentation for all endpoints and parameters.

Related Formats

Frequently Asked Questions

What is a .gdoc file?

A .gdoc file is a Google Drive Document link file. Google Drive Document link (gdoc) is a shortcut file format created and maintained by Google to point to an online Google Docs document. It is commonly used for desktop shortcuts, shared document references, and synchronized access from file managers or backup tools. Because it contains only a reference to a remote document, the file is generally safe, but users should verify the target source before opening shared links.

What are the magic bytes for .gdoc files?

The magic bytes for Google Drive Document link (.gdoc) files are 7B 22 75 72 6C 22 3A 20 22 68 74 74 70 73 3A 2F at byte offset 0. These bytes identify the file format more reliably than the extension alone.

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.