【发布时间】:2020-08-12 11:48:25
【问题描述】:
我想知道是否有可能以某种方式显示使用gridfs.GridFS() 和 pymongo 读取文件的进度。我无法提交可以传递给.read() 函数的回调。
my_db = MongoClient().test
fs = GridFSBucket(my_db)
# get _id of file to read.
file_id = fs.upload_from_stream("huge_test_file", "i carry lots of data!")
grid_out = fs.open_download_stream(file_id)
contents = grid_out.read()
有没有办法实际检索已经下载的字节?考虑到文件可能有 5GB 大,我想提供一些下载状态反馈。
【问题讨论】:
标签: python-3.x pymongo gridfs