Closed covalschi closed 2 years ago
@covalschi how about SetContentString
? Also, you can do something similar to its implementation:
self.content = io.BytesIO(content.encode(encoding))
if self.get("mimeType") is None:
self["mimeType"] = "text/plain"
e.g:
file.content = io.BytesIO( )
It means that you could pass any file-like object, stream to it.
Of course I've tried that, but the problem is with encode(encoding) part - some files just can't be utf-8 encoded.
so, you could pass any bytes stream to it ... file.content = ...
(no need to use SetContentString
). Up to you which encoding to use. By default it's utf-8 / text. But even SetContentString
can be adjusted, you could pass encoding
if you want.
no need to use SetContentString
Ah, never thought about it, thank you!
Hello everyone, I have a feature request.
Can we have a method for GoogleDriveFile to SetContent directly from memory? I have a ton of files on remote servers I have to download from there and upload to google drive, but I don't want to save them to disk just to be read to memory right after.
Thanks for keeping the project alive!