@@ -144,7 +144,7 @@ function makeCallback(cb) {
144
144
throw new ERR_INVALID_CALLBACK ( ) ;
145
145
}
146
146
147
- return function ( ...args ) {
147
+ return ( ...args ) => {
148
148
return Reflect . apply ( cb , undefined , args ) ;
149
149
} ;
150
150
}
@@ -157,7 +157,7 @@ function makeStatsCallback(cb) {
157
157
throw new ERR_INVALID_CALLBACK ( ) ;
158
158
}
159
159
160
- return function ( err , stats ) {
160
+ return ( err , stats ) => {
161
161
if ( err ) return cb ( err ) ;
162
162
cb ( err , getStatsFromBinding ( stats ) ) ;
163
163
} ;
@@ -631,11 +631,11 @@ function truncate(path, len, callback) {
631
631
632
632
validateInteger ( len , 'len' ) ;
633
633
callback = maybeCallback ( callback ) ;
634
- fs . open ( path , 'r+' , function ( er , fd ) {
634
+ fs . open ( path , 'r+' , ( er , fd ) => {
635
635
if ( er ) return callback ( er ) ;
636
636
const req = new FSReqCallback ( ) ;
637
637
req . oncomplete = function oncomplete ( er ) {
638
- fs . close ( fd , function ( er2 ) {
638
+ fs . close ( fd , ( er2 ) => {
639
639
callback ( er || er2 ) ;
640
640
} ) ;
641
641
} ;
@@ -995,15 +995,15 @@ function fchmodSync(fd, mode) {
995
995
996
996
function lchmod ( path , mode , callback ) {
997
997
callback = maybeCallback ( callback ) ;
998
- fs . open ( path , O_WRONLY | O_SYMLINK , function ( err , fd ) {
998
+ fs . open ( path , O_WRONLY | O_SYMLINK , ( err , fd ) => {
999
999
if ( err ) {
1000
1000
callback ( err ) ;
1001
1001
return ;
1002
1002
}
1003
1003
// Prefer to return the chmod error, if one occurs,
1004
1004
// but still try to close, and report closing errors if they occur.
1005
- fs . fchmod ( fd , mode , function ( err ) {
1006
- fs . close ( fd , function ( err2 ) {
1005
+ fs . fchmod ( fd , mode , ( err ) => {
1006
+ fs . close ( fd , ( err2 ) => {
1007
1007
callback ( err || err2 ) ;
1008
1008
} ) ;
1009
1009
} ) ;
@@ -1152,7 +1152,7 @@ function futimesSync(fd, atime, mtime) {
1152
1152
1153
1153
function writeAll ( fd , isUserFd , buffer , offset , length , position , callback ) {
1154
1154
// write(fd, buffer, offset, length, position, callback)
1155
- fs . write ( fd , buffer , offset , length , position , function ( writeErr , written ) {
1155
+ fs . write ( fd , buffer , offset , length , position , ( writeErr , written ) => {
1156
1156
if ( writeErr ) {
1157
1157
if ( isUserFd ) {
1158
1158
callback ( writeErr ) ;
@@ -1188,7 +1188,7 @@ function writeFile(path, data, options, callback) {
1188
1188
return ;
1189
1189
}
1190
1190
1191
- fs . open ( path , flag , options . mode , function ( openErr , fd ) {
1191
+ fs . open ( path , flag , options . mode , ( openErr , fd ) => {
1192
1192
if ( openErr ) {
1193
1193
callback ( openErr ) ;
1194
1194
} else {
@@ -1531,7 +1531,7 @@ function realpathSync(p, options) {
1531
1531
}
1532
1532
1533
1533
1534
- realpathSync . native = function ( path , options ) {
1534
+ realpathSync . native = ( path , options ) => {
1535
1535
options = getOptions ( options , { } ) ;
1536
1536
path = toPathIfFileURL ( path ) ;
1537
1537
validatePath ( path ) ;
@@ -1572,7 +1572,7 @@ function realpath(p, options, callback) {
1572
1572
1573
1573
// On windows, check that the root exists. On unix there is no need.
1574
1574
if ( isWindows && ! knownHard [ base ] ) {
1575
- fs . lstat ( base , function ( err , stats ) {
1575
+ fs . lstat ( base , ( err , stats ) => {
1576
1576
if ( err ) return callback ( err ) ;
1577
1577
knownHard [ base ] = true ;
1578
1578
LOOP ( ) ;
@@ -1636,10 +1636,10 @@ function realpath(p, options, callback) {
1636
1636
return gotTarget ( null , seenLinks [ id ] , base ) ;
1637
1637
}
1638
1638
}
1639
- fs . stat ( base , function ( err ) {
1639
+ fs . stat ( base , ( err ) => {
1640
1640
if ( err ) return callback ( err ) ;
1641
1641
1642
- fs . readlink ( base , function ( err , target ) {
1642
+ fs . readlink ( base , ( err , target ) => {
1643
1643
if ( ! isWindows ) seenLinks [ id ] = target ;
1644
1644
gotTarget ( err , target ) ;
1645
1645
} ) ;
@@ -1660,7 +1660,7 @@ function realpath(p, options, callback) {
1660
1660
1661
1661
// On windows, check that the root exists. On unix there is no need.
1662
1662
if ( isWindows && ! knownHard [ base ] ) {
1663
- fs . lstat ( base , function ( err ) {
1663
+ fs . lstat ( base , ( err ) => {
1664
1664
if ( err ) return callback ( err ) ;
1665
1665
knownHard [ base ] = true ;
1666
1666
LOOP ( ) ;
@@ -1672,7 +1672,7 @@ function realpath(p, options, callback) {
1672
1672
}
1673
1673
1674
1674
1675
- realpath . native = function ( path , options , callback ) {
1675
+ realpath . native = ( path , options , callback ) => {
1676
1676
callback = makeCallback ( callback || options ) ;
1677
1677
options = getOptions ( options , { } ) ;
1678
1678
path = toPathIfFileURL ( path ) ;
0 commit comments