cojs / busboy

Busboy multipart parser as a yieldable
154 stars 24 forks source link

How to use Busboy (special) events #12

Closed kevinprotoss closed 10 years ago

kevinprotoss commented 10 years ago

Hello,

In the doc, I did not found these relevant infos. I check the source code of this module as well. These events seems not to be registered or handled. How could I use co-busboy in Koa.js together with the limits check?

Best regards, Kevin

haoxins commented 10 years ago

for limits check

add the limits option

var parts = parse(this, {
  limits = {
    fileSize: 10 * 1024 * 1024
  }
})
kevinprotoss commented 10 years ago

Hello,

You are right and I know this option as well. However, how can I get these events for example filesLimit or do some custom handler for this event during yield?

Best regards, Kevin

haoxins commented 10 years ago

@kevinprotoss is this pr useful?

kevinprotoss commented 10 years ago

Hello,

@coderhaoxin your pr is useful Still one question, according to the example in thr readme

part.pipe(fs.createWriteStream('some file.txt'))

How can Koa.js or co stuff wait for the end of such pipe? I think Koa.js will just call next middleware or response after call pipe. However, I need the result of pipe, how to make this possible?

Best regards, Kevin

haoxins commented 10 years ago

there are some useful modules for this, such as save-to ......

haoxins commented 10 years ago

@kevinprotoss version 1.1.0 published

kevinprotoss commented 10 years ago

Hello coderhaoxin,

Thanks for your work. I do not use this save-to function, since it's a little different with what I want. However, it gives me some hint, how to make a pipe stream yiedable.

Btw, about this status code of limits relevant error, I doubt whether 413 is more suitable for some limits, e.g., Request size limit.

Bg, Kevin

haoxins commented 10 years ago

yes, 413 is better.

haoxins commented 10 years ago

@kevinprotoss check version@1.2.0

bianjp commented 8 years ago

@kevinprotoss

How can Koa.js or co stuff wait for the end of such pipe? I think Koa.js will just call next middleware or response after call pipe. However, I need the result of pipe, how to make this possible?

I met the same problem. It would be nice to point out the problem and provide possible solutions in README. Would you be so kind as to make a pull request?