Closed samhuk closed 3 years ago
Hello dear @sanuks1 :) well. let me start by saying that this is a abstract component, which will never discriminate if the payload is a file or a buffer. I dont agree on this issue (in good terms of course :) because in the worst case you can overload the process() method to provide the correct behavior that better match your requirements.
Thank you for your response. "file or a buffer" is maybe not the right terminology here, since part.part
is always a byte array. What you discriminate against is simply the contentType
. I'de say it would make a lot of sense to a consumer if the plain/text part.part
items are available as strings. It means that other people's code doesn't have to do the fileContentTypes
<-> contentType
mapping or the fromCharCode
. This hasn't been asked before however, so maybe it isn't a worthwhile feature. I understand your point, which I think is to keep the code simple.
in
Parse.process()
, should discriminate the parsing of form-data items depending on their content-type, i.e:This makes the resulting object "parts" a lot more useful to a consumer.