Trimatix / AEPi

Read and write Abyss Engine Image (AEI) files from python, for Galaxy on Fire 2
Apache License 2.0
2 stars 0 forks source link

write AEI to file path #39

Open Trimatix opened 3 months ago

Trimatix commented 3 months ago

The AEI.write interface currently requires the use of BinaryIO. A convenience method where we only need to pass a file path string/pathlike would be very nice.

This method shouldn't return anything, since the 'output' of the method is a file on disk; the following doesn't make sense:

out = aei.write("myfile.aei")
out.close()

with aei.write("myfile.aei"):
  pass

A new method seems to make the most sense:

def writeToFile(path: Union[str, bytes, os.PathLike, format: Optional[CompressionFormat] = None, quality: Optional[CompressionQuality] = None) -> int:
  ...

The return value can be the number of bytes written. Internally, this method can just wrap AEI.write in a with BytesIO(path).