{
    "content": [
        {
            "type": "text",
            "text": "# chunk (pydoc)\n\n**Summary:** chunk - Simple class to read IFF chunks.\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **MODULE REFERENCE** (8 lines)\n- **DESCRIPTION** (40 lines) — 1 subsections\n  - getname (5 lines)\n- **CLASSES** (3 lines) — 1 subsections\n  - class Chunk (44 lines)\n- **FILE** (3 lines)\n\n## Full Content\n\n### NAME\n\nchunk - Simple class to read IFF chunks.\n\n### MODULE REFERENCE\n\nhttps://docs.python.org/3.10/library/chunk.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n\n### DESCRIPTION\n\nAn IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File\nFormat)) has the following structure:\n\n+----------------+\n| ID (4 bytes)   |\n+----------------+\n| size (4 bytes) |\n+----------------+\n| data           |\n| ...            |\n+----------------+\n\nThe ID is a 4-byte string which identifies the type of chunk.\n\nThe size field (a 32-bit value, encoded using big-endian byte order)\ngives the size of the whole chunk, including the 8-byte header.\n\nUsually an IFF-type file consists of one or more chunks.  The proposed\nusage of the Chunk class defined here is to instantiate an instance at\nthe start of each chunk and read from the instance until it reaches\nthe end, after which a new instance can be instantiated.  At the end\nof the file, creating a new instance will fail with an EOFError\nexception.\n\nUsage:\nwhile True:\ntry:\nchunk = Chunk(file)\nexcept EOFError:\nbreak\nchunktype = chunk.getname()\nwhile True:\ndata = chunk.read(nbytes)\nif not data:\npass\n# do something with data\n\nThe interface is file-like.  The implemented methods are:\nread, close, seek, tell, isatty.\nExtra methods are: skip() (called by close, skips to the end of the chunk),\n\n#### getname\n\nThe init method has one required argument, a file-like object\n(including a chunk instance), and one optional argument, a flag which\nspecifies whether or not chunks are aligned on 2-byte boundaries.  The\ndefault is 1, i.e. aligned.\n\n### CLASSES\n\nbuiltins.object\nChunk\n\n#### class Chunk\n\n|  Chunk(file, align=True, bigendian=True, inclheader=False)\n|\n|  Methods defined here:\n|\n|  init(self, file, align=True, bigendian=True, inclheader=False)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  close(self)\n|\n|  getname(self)\n|      Return the name (ID) of the current chunk.\n|\n|  getsize(self)\n|      Return the size of the current chunk.\n|\n|  isatty(self)\n|\n|  read(self, size=-1)\n|      Read at most size bytes from the chunk.\n|      If size is omitted or negative, read until the end\n|      of the chunk.\n|\n|  seek(self, pos, whence=0)\n|      Seek to specified position into the chunk.\n|      Default position is 0 (start of chunk).\n|      If the file is not seekable, this will result in an error.\n|\n|  skip(self)\n|      Skip the rest of the chunk.\n|      If you are not interested in the contents of the chunk,\n|      this method should be called so that the file points to\n|      the start of the next chunk.\n|\n|  tell(self)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n\n### FILE\n\n/usr/lib/python3.10/chunk.py\n\n"
        }
    ],
    "structuredContent": {
        "command": "chunk",
        "section": "",
        "mode": "pydoc",
        "summary": "chunk - Simple class to read IFF chunks.",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "MODULE REFERENCE",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 40,
                "subsections": [
                    {
                        "name": "getname",
                        "lines": 5
                    }
                ]
            },
            {
                "name": "CLASSES",
                "lines": 3,
                "subsections": [
                    {
                        "name": "class Chunk",
                        "lines": 44
                    }
                ]
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}