django实现二进制文件(流文件)web中转
- 一般这种情况是:需要用到中间服务B做权限限制或者其他限制性开发,那么在大文件传输时我们希望权限等限制条件通过后,文件直接传输到目的服务C,因为这样就可用不用在中间服务存临时文件,节省更多开销
这里用application/octet-stream的方式做演示:
import requests
# 解析器
class ChunkIter:
"""
An iterable that will yield chunks of data. Given a file-like object as the
constructor, yield chunks of read operations from that object.
"""
def __init__(self, flo, chunk_