coolaj86 / formaline

formaline is a module for handling form requests ( HTTP POSTs / PUTs ) and for fast parsing of file uploads.
Apache License 2.0
239 stars 16 forks source link

consistency in `end` and `dataprogress` events (and perhaps XHR2 API) #4

Closed coolaj86 closed 13 years ago

coolaj86 commented 13 years ago

fields is an array. I like this.

shouldn't completed be named files and also be an array rather than a hash/map?

It seems there should be an exceptions array (this could contain the incomplete files).

it would be nice if dataprogress and end events were of the same type and had the same fields - the only difference being that end would be the very last dataprogress event.

Lastly, I'd prefer that the event names match up with the XHR2 API.

Errors

Successes

End

rootslab commented 13 years ago

Sorry coolaj86, I'm very interested in your comments, but I have no time for now!! I'll be very happy, if we can wait some days to talk about these things! However, I can do some modifications for your needs! Thanks, for now!

coolaj86 commented 13 years ago

Example: When I want to know how many files I've received:

Object.keys(ev.completed).length vs files.length

Here's another possible consideration for the progress / end events. I'll have to play with the idea and see if it works well.

fields: [
    {
        name: "field-name"
      , value: {
              name: "file.ext"
            , path: "/tmp/xyz/c876efe93eaceb482ba74...e85.ext" 
            , ...
        }
    }
  , {
        name: "other-field-name"
      , value: ""
      , exception: { ... }
    }
]
coolaj86 commented 13 years ago

Yeah, perhaps we can get on IRC sometime and talk about it and invite some of the other watchers.

rootslab commented 13 years ago

Yes!! I'd like to invite also dvv, I'm becoming his nightmare!! :D

rootslab commented 13 years ago

Update:

From module version 0.5.0 :

  • json.completed property now is named json.files and it is an array rather than a hash/map .
rootslab commented 13 years ago

Update:

From module version 0.5.3 (now on test) :

  • changed all events names/types for consistency with XHR2 API
  • new json response objects..