{"success":true,"data":{"ext":"cgm","name":"CGM","description":"Computer Graphics Metafile (CGM) is a vector graphics file format standardized by the International Organization for Standardization (ISO) for describing two-dimensional graphics. It is used for technical illustrations, engineering drawings, and interchange between CAD, publishing, and scientific visualization systems. CGM is a legacy format, and files from untrusted sources should be handled with normal caution because some viewers have historically supported embedded content.","mime":["image/cgm"],"risk_level":"Safe","signatures":[{"hex":"42 45 47 4D 46","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"00 20","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]}],"related":["dwg","emf","svg","svgz","wmf","ai"],"usage":{"python":"def is_cgm(file_path: str) -> bool:\n    \"\"\"Check if file is a valid CGM by magic bytes.\"\"\"\n    signature = bytes([0x42, 0x45, 0x47, 0x4D, 0x46])\n    with open(file_path, \"rb\") as f:\n        return f.read(5) == signature","node":"function isCGM(buffer: Buffer): boolean {\n  const signature = Buffer.from([0x42, 0x45, 0x47, 0x4D, 0x46]);\n  return buffer.subarray(0, 5).equals(signature);\n}","go":"func IsCGM(data []byte) bool {\n    signature := []byte{0x42, 0x45, 0x47, 0x4D, 0x46}\n    if len(data) < 5 {\n        return false\n    }\n    return bytes.Equal(data[:5], signature)\n}"},"category":"Images"}}