Open jaksatomovic opened 7 months ago
You can do something like this. Instead of providing file name you can provide io.BytesIO object and then you can save content of that buffer from the memory to the file, database or anywhere you want. In this example I save it to the file but you can pass content of bk.getbuffer() anywhere you want.
import io
bk = io.BytesIO()
epub.write_epub(bk, book, {})
with open("book.epub", "wb") as f:
f.write(bk.getbuffer())
I want to create book but instead of saving it to file and then storing it to db it would be nice to do this directly