@@ -34,17 +34,12 @@ const connected = (ripple, ss) => socket => {
3434 } )
3535
3636 const end = ( socket , id ) => {
37- const type = 'upload'
38- , resource = buffer [ id ] . resource
39- , value = buffer [ id ] . fields
40- , time = buffer [ id ] . time
41- , res = buffer [ id ] . res
42- , from = key ( `resources.${ resource } .headers.from` ) ( ripple )
43- , { name } = resource
37+ const { resource, fields, time, res } = buffer [ id ]
38+ , from = key ( `resources.${ resource } .headers.from` ) ( ripple )
4439
4540 log ( 'finished' , id , time )
4641 if ( ! from ) return err ( 'no handler for' , resource )
47- from ( { name, type, value, socket } , res )
42+ from ( { name : resource , type : 'upload' , value : fields , socket } , res )
4843 delete buffer [ id ]
4944 }
5045}
@@ -79,7 +74,7 @@ const up = ripple => (resource, data) => {
7974
8075 ss ( ripple . io ) . emit ( 'file' , stream , { filename, size, name, i, time } )
8176 ss . createBlobReadStream ( file )
82- . on ( 'data' , function ( chunk ) {
77+ . on ( 'data' , chunk => {
8378 uploadedSize += chunk . length
8479 ret . emit ( 'progress' , ~ ~ ( uploadedSize / totalSize * 100 ) )
8580 } )
0 commit comments