GeoSales-Evolution / multi-tenant-uploader

OSS solution for uploading files to ☁️ in a multi-tenant context
MIT License
5 stars 0 forks source link

server capable of receiving octet stream and save in FS #2

Open jeffque opened 1 year ago

uxjp commented 1 year ago

https://github.com/uxjp/file-stream-server/blob/main/express/server.js
Exemple of Express sever receing (pdf, jpg, jpeg, png) and saving to FS.

brenoaraujolima commented 1 year ago

Is there any particular reason to send file as application/octet-stream ? Currently, In https://github.com/GeoSales-Evolution/multi-tenant-uploader/pull/10/commits/bb4ad2340dd75c5f29f8f9b801f863993e62a074 , I'm sending multiple files as multipart/form-data enconding. Using @uxjp strategy, It's possible sending as octet-stream, but only one single file for request.

uxjp commented 1 year ago

The context in wich this project involves was idealized involves a Mobile App and a Web. In yesterday's voice call with @julio180
he mentioned that is easier for the apps to store files in memory as binary, and sending aftewards for our server(which must be developed in this present repo).

uxjp commented 1 year ago

A priori multiple files per request support wasn't in the imediate concerns. Although we must create an issue to discuss it.

jeffque commented 1 year ago

@uxjp

A priori multiple files per request support wasn't in the imediate concerns.

Unnecessary. No need. Avoid it.

What should be behavior of a failure in the middle of multiple files upload? Fail everything, including from before? Failing from there onwards? Keep optimism and fail only this single file and try the others?

As this server is de facto a async function upload: {data, {user, tenant}} => link, for the same {user, tenant} one can create a currying such that prepareUpload: {user, tenant} => (data => link). And, with this, one can use a transformation for a data[] => link[].

One only need to upload a single file at a time, and do it properly.