alfred icon indicating copy to clipboard operation
alfred copied to clipboard

how I upload big file?

Open ali-1989 opened this issue 3 years ago • 1 comments

Hello. First of all, thank you for this useful package.

I want to get large files, for example 2 GB. Is the file received in memory? Is it possible for me to give the file path to be saved in pieces?

ali-1989 avatar Jul 15 '21 15:07 ali-1989

I had previously written a package similar to Alfred in Java.

I used this method to handle the above issue

A method was added by the customer (programmer) to the server, which was called when it came in contact with the file, and the file storage path was asked, and the bytes were stored one after the other.

See savePath()

var server = Alfred(logLevel: LogType.debug);

server.savePath(String (HttpRequest req, String fileName) => 'save/path/relative/to/request');  // here
server.post('/register', RegisterResponse.register);
.
.
.

this method, will called when the alfred serever arrive to a file. This prevents memory from being occupied.

ali-1989 avatar Jul 15 '21 16:07 ali-1989