2๐
โ
fs = gridfs.GridFS(db)
gridout = fs.get_last_version("testimage")
The gridout
object is an instance of GridOut for reading files. You could get all the bytes at once with gridout.read()
, or iterate over chunks of bytes like:
for chunk in gridout:
do_something_with(chunk)
GridFS chunks are about 256k by default.
Source:stackexchange.com