@@ -137,7 +137,7 @@ function makeCallback(cb) {
137
137
throw new ERR_INVALID_CALLBACK ( ) ;
138
138
}
139
139
140
- return function ( ...args ) {
140
+ return ( ...args ) => {
141
141
return Reflect . apply ( cb , undefined , args ) ;
142
142
} ;
143
143
}
@@ -150,7 +150,7 @@ function makeStatsCallback(cb) {
150
150
throw new ERR_INVALID_CALLBACK ( ) ;
151
151
}
152
152
153
- return function ( err , stats ) {
153
+ return ( err , stats ) => {
154
154
if ( err ) return cb ( err ) ;
155
155
cb ( err , getStatsFromBinding ( stats ) ) ;
156
156
} ;
@@ -608,11 +608,11 @@ function truncate(path, len, callback) {
608
608
609
609
validateInteger ( len , 'len' ) ;
610
610
callback = maybeCallback ( callback ) ;
611
- fs . open ( path , 'r+' , function ( er , fd ) {
611
+ fs . open ( path , 'r+' , ( er , fd ) => {
612
612
if ( er ) return callback ( er ) ;
613
613
const req = new FSReqWrap ( ) ;
614
614
req . oncomplete = function oncomplete ( er ) {
615
- fs . close ( fd , function ( er2 ) {
615
+ fs . close ( fd , ( er2 ) => {
616
616
callback ( er || er2 ) ;
617
617
} ) ;
618
618
} ;
@@ -972,15 +972,15 @@ function fchmodSync(fd, mode) {
972
972
973
973
function lchmod ( path , mode , callback ) {
974
974
callback = maybeCallback ( callback ) ;
975
- fs . open ( path , O_WRONLY | O_SYMLINK , function ( err , fd ) {
975
+ fs . open ( path , O_WRONLY | O_SYMLINK , ( err , fd ) => {
976
976
if ( err ) {
977
977
callback ( err ) ;
978
978
return ;
979
979
}
980
980
// Prefer to return the chmod error, if one occurs,
981
981
// but still try to close, and report closing errors if they occur.
982
- fs . fchmod ( fd , mode , function ( err ) {
983
- fs . close ( fd , function ( err2 ) {
982
+ fs . fchmod ( fd , mode , ( err ) => {
983
+ fs . close ( fd , ( err2 ) => {
984
984
callback ( err || err2 ) ;
985
985
} ) ;
986
986
} ) ;
@@ -1129,7 +1129,7 @@ function futimesSync(fd, atime, mtime) {
1129
1129
1130
1130
function writeAll ( fd , isUserFd , buffer , offset , length , position , callback ) {
1131
1131
// write(fd, buffer, offset, length, position, callback)
1132
- fs . write ( fd , buffer , offset , length , position , function ( writeErr , written ) {
1132
+ fs . write ( fd , buffer , offset , length , position , ( writeErr , written ) => {
1133
1133
if ( writeErr ) {
1134
1134
if ( isUserFd ) {
1135
1135
callback ( writeErr ) ;
@@ -1165,7 +1165,7 @@ function writeFile(path, data, options, callback) {
1165
1165
return ;
1166
1166
}
1167
1167
1168
- fs . open ( path , flag , options . mode , function ( openErr , fd ) {
1168
+ fs . open ( path , flag , options . mode , ( openErr , fd ) => {
1169
1169
if ( openErr ) {
1170
1170
callback ( openErr ) ;
1171
1171
} else {
@@ -1508,7 +1508,7 @@ function realpathSync(p, options) {
1508
1508
}
1509
1509
1510
1510
1511
- realpathSync . native = function ( path , options ) {
1511
+ realpathSync . native = ( path , options ) => {
1512
1512
options = getOptions ( options , { } ) ;
1513
1513
path = toPathIfFileURL ( path ) ;
1514
1514
validatePath ( path ) ;
@@ -1549,7 +1549,7 @@ function realpath(p, options, callback) {
1549
1549
1550
1550
// On windows, check that the root exists. On unix there is no need.
1551
1551
if ( isWindows && ! knownHard [ base ] ) {
1552
- fs . lstat ( base , function ( err , stats ) {
1552
+ fs . lstat ( base , ( err , stats ) => {
1553
1553
if ( err ) return callback ( err ) ;
1554
1554
knownHard [ base ] = true ;
1555
1555
LOOP ( ) ;
@@ -1613,10 +1613,10 @@ function realpath(p, options, callback) {
1613
1613
return gotTarget ( null , seenLinks [ id ] , base ) ;
1614
1614
}
1615
1615
}
1616
- fs . stat ( base , function ( err ) {
1616
+ fs . stat ( base , ( err ) => {
1617
1617
if ( err ) return callback ( err ) ;
1618
1618
1619
- fs . readlink ( base , function ( err , target ) {
1619
+ fs . readlink ( base , ( err , target ) => {
1620
1620
if ( ! isWindows ) seenLinks [ id ] = target ;
1621
1621
gotTarget ( err , target ) ;
1622
1622
} ) ;
@@ -1637,7 +1637,7 @@ function realpath(p, options, callback) {
1637
1637
1638
1638
// On windows, check that the root exists. On unix there is no need.
1639
1639
if ( isWindows && ! knownHard [ base ] ) {
1640
- fs . lstat ( base , function ( err ) {
1640
+ fs . lstat ( base , ( err ) => {
1641
1641
if ( err ) return callback ( err ) ;
1642
1642
knownHard [ base ] = true ;
1643
1643
LOOP ( ) ;
@@ -1649,7 +1649,7 @@ function realpath(p, options, callback) {
1649
1649
}
1650
1650
1651
1651
1652
- realpath . native = function ( path , options , callback ) {
1652
+ realpath . native = ( path , options , callback ) => {
1653
1653
callback = makeCallback ( callback || options ) ;
1654
1654
options = getOptions ( options , { } ) ;
1655
1655
path = toPathIfFileURL ( path ) ;
0 commit comments