Closed tj closed 10 years ago
if you can think of a good api i'll try to tackle it. not 100% sure how multipart works yet
here's what i did for connect's but ideally we have a { multiple: true }
option since it's a little confusing for people to somethings have an array and sometimes have a single part if you don't opt-in https://github.com/senchalabs/connect/blob/master/lib/middleware/multipart.js#L115
i guess you want .fields
as an object, right? it's kind of weird because busboy has truncated booleans which i don't know how to handle (i don't know what that even means). right now i just return it as an array.
there's also other stuff. gotta handle cases where people yield between parts.
var part
while (part = yield parser.part()) {
yield save(part, 'some file.txt') // this could take too long
}
a part can be emitted between part()
s.
then people might want the fields
before any of the parts (like CSRF, you can validate before handling any streams). not sure how to handle that either except by doing field = yield parser.field()
, but then that's annoying because you gotta do while (next = (yield parser.part()) || (yield parser.field()))
and then type check.
HOORAY FOR GENERATORS.
actually nvm i guess it's not really a concern haha, gotta get my mind out of the non-sync gutter, the .part() stuff should be just fine
i think this module is going to be a pain in the ass, just like multipart always is
with an option to transform it into an array when more than one are present