@@ -4,6 +4,7 @@ import {CreateReadStreamOptions, CreateWriteStreamOptions} from './FakeFS';
44import { Dirent , SymlinkType } from './FakeFS' ;
55import { BasePortableFakeFS , WriteFileOptions } from './FakeFS' ;
66import { MkdirOptions , WatchOptions , WatchCallback , Watcher } from './FakeFS' ;
7+ import { ENOSYS } from './errors' ;
78import { FSPath , PortablePath , Filename , npath } from './path' ;
89
910export class NodeFS extends BasePortableFakeFS {
@@ -13,6 +14,12 @@ export class NodeFS extends BasePortableFakeFS {
1314 super ( ) ;
1415
1516 this . realFs = realFs ;
17+
18+ // @ts -ignore
19+ if ( typeof this . realFs . lutimes !== `undefined` ) {
20+ this . lutimesPromise = this . lutimesPromiseImpl ;
21+ this . lutimesSync = this . lutimesSyncImpl ;
22+ }
1623 }
1724
1825 getExtractHint ( ) {
@@ -233,6 +240,26 @@ export class NodeFS extends BasePortableFakeFS {
233240 this . realFs . utimesSync ( npath . fromPortablePath ( p ) , atime , mtime ) ;
234241 }
235242
243+ private async lutimesPromiseImpl ( this : NodeFS , p : PortablePath , atime : Date | string | number , mtime : Date | string | number ) {
244+ // @ts -ignore: Not yet in DefinitelyTyped
245+ const lutimes = this . realFs . lutimes ;
246+ if ( typeof lutimes === `undefined` )
247+ throw ENOSYS ( `unavailable Node binding` , `lutimes '${ p } '` ) ;
248+
249+ return await new Promise < void > ( ( resolve , reject ) => {
250+ lutimes . call ( this . realFs , npath . fromPortablePath ( p ) , atime , mtime , this . makeCallback ( resolve , reject ) ) ;
251+ } ) ;
252+ }
253+
254+ private lutimesSyncImpl ( this : NodeFS , p : PortablePath , atime : Date | string | number , mtime : Date | string | number ) {
255+ // @ts -ignore: Not yet in DefinitelyTyped
256+ const lutimesSync = this . realFs . lutimesSync ;
257+ if ( typeof lutimesSync === `undefined` )
258+ throw ENOSYS ( `unavailable Node binding` , `lutimes '${ p } '` ) ;
259+
260+ lutimesSync . call ( this . realFs , npath . fromPortablePath ( p ) , atime , mtime ) ;
261+ }
262+
236263 async mkdirPromise ( p : PortablePath , opts ?: MkdirOptions ) {
237264 return await new Promise < void > ( ( resolve , reject ) => {
238265 this . realFs . mkdir ( npath . fromPortablePath ( p ) , opts , this . makeCallback ( resolve , reject ) ) ;
0 commit comments