(Nov-21-2019, 06:58 AM)andym118 Wrote: Is it possible to make the uploaded file go straight to the hard drive instead of memory though?
If the system is capable of sendfile(2), you can make a zero-copy from a socket to a file descriptor and reversed.
Here is a module, which supports it: https://pypi.org/project/pysendfile/
Under the hood they use mmap.
Another very important thing is following:
Quote:Also, it must be clear that the file can only be sent “as is” (e.g. you can’t modify the content while transmitting). There might be problems with non regular filesystems such as NFS, SMBFS/Samba and CIFS. For this please refer to proftpd documentation.
This means, that you can't modify the stream on the fly.
EDIT: It seems, that this has been implemented since Python 3.3: http://michaldul.com/python/sendfile/
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!