@@ -2026,30 +2026,27 @@ ReadStream.prototype._read = function(n) {
20262026 return this . push ( null ) ;
20272027
20282028 // the actual read.
2029- var self = this ;
2030- fs . read ( this . fd , pool , pool . used , toRead , this . pos , onread ) ;
2031-
2032- // move the pool positions, and internal position for reading.
2033- if ( this . pos !== undefined )
2034- this . pos += toRead ;
2035- pool . used += toRead ;
2036-
2037- function onread ( er , bytesRead ) {
2029+ fs . read ( this . fd , pool , pool . used , toRead , this . pos , ( er , bytesRead ) => {
20382030 if ( er ) {
2039- if ( self . autoClose ) {
2040- self . destroy ( ) ;
2031+ if ( this . autoClose ) {
2032+ this . destroy ( ) ;
20412033 }
2042- self . emit ( 'error' , er ) ;
2034+ this . emit ( 'error' , er ) ;
20432035 } else {
20442036 var b = null ;
20452037 if ( bytesRead > 0 ) {
2046- self . bytesRead += bytesRead ;
2038+ this . bytesRead += bytesRead ;
20472039 b = thisPool . slice ( start , start + bytesRead ) ;
20482040 }
20492041
2050- self . push ( b ) ;
2042+ this . push ( b ) ;
20512043 }
2052- }
2044+ } ) ;
2045+
2046+ // move the pool positions, and internal position for reading.
2047+ if ( this . pos !== undefined )
2048+ this . pos += toRead ;
2049+ pool . used += toRead ;
20532050} ;
20542051
20552052
@@ -2143,7 +2140,7 @@ fs.FileWriteStream = fs.WriteStream; // support the legacy name
21432140
21442141
21452142WriteStream . prototype . open = function ( ) {
2146- fs . open ( this . path , this . flags , this . mode , function ( er , fd ) {
2143+ fs . open ( this . path , this . flags , this . mode , ( er , fd ) => {
21472144 if ( er ) {
21482145 if ( this . autoClose ) {
21492146 this . destroy ( ) ;
@@ -2154,7 +2151,7 @@ WriteStream.prototype.open = function() {
21542151
21552152 this . fd = fd ;
21562153 this . emit ( 'open' , fd ) ;
2157- } . bind ( this ) ) ;
2154+ } ) ;
21582155} ;
21592156
21602157
@@ -2168,15 +2165,14 @@ WriteStream.prototype._write = function(data, encoding, cb) {
21682165 } ) ;
21692166 }
21702167
2171- var self = this ;
2172- fs . write ( this . fd , data , 0 , data . length , this . pos , function ( er , bytes ) {
2168+ fs . write ( this . fd , data , 0 , data . length , this . pos , ( er , bytes ) => {
21732169 if ( er ) {
2174- if ( self . autoClose ) {
2175- self . destroy ( ) ;
2170+ if ( this . autoClose ) {
2171+ this . destroy ( ) ;
21762172 }
21772173 return cb ( er ) ;
21782174 }
2179- self . bytesWritten += bytes ;
2175+ this . bytesWritten += bytes ;
21802176 cb ( ) ;
21812177 } ) ;
21822178
0 commit comments