Closed GrosSacASac closed 2 years ago
@Akxe and @wbt please review, if it looks good I will add a few automated test and then merge
Has to be used with filename option (otherwise hexoid creates a flat random name)
Well I feel a little silly for having recently spent a bunch of time implementing something similar outside Formidable. I haven't done any testing on the proposed code and see it's failing the existing automated tests, which seems concerning. I didn't spot any red flags in a quick pass through the code, but would likely want to see tests passing before I would recommend a merge.
Thanks for the input, some tests are failing but they failed before it has nothing to do with this change. There is an issue open about failing tests I think which I would try to handle after this PR.
I am not sure about everything being sync fs operations.
From TS point of view, it does not change much...
Finally shouldn't there be some FS error handling? Does the form processing need to stop, because of an error in saving a file?
Closing in favor of https://github.com/node-formidable/formidable/pull/855 please have a look there
Allows to upload directories and keep their structure with on the client side
Add a new options createDirsFromUploads that will create necessary directories from filename before uploading process. For example if "a/b.txt" is sent in from the browser
then uploads folder will be uploads/a/b.txt