synchronoss / nio-multipart

A multipart library that uses nio and asynchronous processing
Apache License 2.0
93 stars 20 forks source link

provide something like onPartBodyStarted for streaming upload without tmp files #13

Open wingyiu opened 5 years ago

wingyiu commented 5 years ago

any possible?

wingyiu commented 5 years ago

like pipeline uploading to aws

defnull commented 5 years ago

https://github.com/synchronoss/nio-multipart#a-powerful-extension-point

skinkie commented 4 years ago

@defnull while it can be implemented that way, for example the headers are available at the point where the write of the file starts I would see a use case for just having the headers in a more abstract part of the application. Given that the custom PartBodyStreamStorageFactory can be initialised with any context that the application can possible ask for it can't be initialised with values it does not know. For example if I would have two parts one is some identifier and one in the file contents, the parsed contents of part 1 would not be available in part 2. In order to provide such information for the to be uploaded bucket more context should be available in newStreamStorageForPartBody. My own use case would be passing the temporary filename to the rest of the application for monitoring. I am currently setting this filename to something the rest of the application is aware of.

defnull commented 4 years ago

I'd just let my NioMultipartParserListener also implement PartBodyStreamStorageFactory, or share the important state between both instances in some other way. Then you'd have all context you could ask for when newStreamStorageForPartBody is called.