{"id":21339,"library":"filechunkio","title":"FileChunkIO","description":"FileChunkIO provides a file-like object representing a chunk of an OS-level file, supporting reading, writing, and random access within a byte range. Version 1.8 is the latest (2014), with no recent updates; stable but unmaintained.","status":"maintenance","version":"1.8","language":"python","source_language":"en","source_url":"https://github.com/joshthecoder/filechunkio","tags":["file","chunk","io","binary"],"install":[{"cmd":"pip install filechunkio","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"Standard import path","wrong":"","symbol":"FileChunkIO","correct":"from filechunkio import FileChunkIO"}],"quickstart":{"code":"from filechunkio import FileChunkIO\n\nwith open('test.bin', 'wb') as f:\n    f.write(b'a' * 1024)\n\nwith FileChunkIO('test.bin', 'r', offset=0, bytes=512) as chunk:\n    data = chunk.read()\n    print(len(data))  # 512","lang":"python","description":"Opens a chunk of 'test.bin' from offset 0 for 512 bytes and reads it."},"warnings":[{"fix":"Use 'r+' mode and write only within the intended byte range; avoid 'w' mode unless you intend to truncate the whole file.","message":"FileChunkIO does not support 'w' mode for writing arbitrarily; only 'r', 'r+', 'a', 'a+', 'w', 'w+'. Opening with 'w' truncates the entire file, not just the chunk range.","severity":"gotcha","affected_versions":"<2.0"},{"fix":"Consider alternatives like 'io.BytesIO' or 'mmap' if possible.","message":"This library is effectively unmaintained since 2014. No Python 3 support beyond basic compatibility; may have issues with newer Python versions (e.g., file descriptor handling).","severity":"deprecated","affected_versions":"all"},{"fix":"Ensure you compute the correct byte count; do not mistake 'bytes' for end offset.","message":"The 'bytes' parameter specifies the number of bytes in the chunk, not the end offset. The actual accessible region is [offset, offset+bytes). If 'bytes' is None, the chunk extends to end of file.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Convert offset and bytes to int explicitly: int(offset).","cause":"Passing non-integer types (e.g., strings) for offset or bytes raises TypeError.","error":"FileChunkIO requires integer offset and bytes"},{"fix":"Ensure all operations are done within a context manager or before calling close().","cause":"Attempting to read/write after closing the FileChunkIO object.","error":"ValueError: I/O operation on closed file"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}