io.rst 793 B

12345678910111213141516171819202122232425
  1. IO
  2. ===
  3. Aims for read or write bytes from different media, Currently We provide ``S3Reader``, ``S3Writer`` for AWS S3 compatible media
  4. and ``HttpReader``, ``HttpWriter`` for remote Http file. You can implement new classes to meet the needs of your personal scenarios
  5. if MinerU have not provide the suitable classes. It is easy to implement new classes, the only one requirement is to inherit from
  6. ``IOReader`` or ``IOWriter``
  7. .. code:: python
  8. class SomeReader(IOReader):
  9. def read(self, path: str) -> bytes:
  10. pass
  11. def read_at(self, path: str, offset: int = 0, limit: int = -1) -> bytes:
  12. pass
  13. class SomeWriter(IOWriter):
  14. def write(self, path: str, data: bytes) -> None:
  15. pass
  16. Check :doc:`../../api/io` for more details