@@ -12,6 +12,7 @@ const {
12
12
NumberIsFinite,
13
13
MathMin,
14
14
MathRound,
15
+ ObjectDefineProperty,
15
16
ObjectIs,
16
17
ObjectSetPrototypeOf,
17
18
ReflectApply,
@@ -462,15 +463,51 @@ function BigIntStats(dev, mode, nlink, uid, gid, rdev, blksize,
462
463
this . mtimeNs = mtimeNs ;
463
464
this . ctimeNs = ctimeNs ;
464
465
this . birthtimeNs = birthtimeNs ;
465
- this . atime = dateFromMs ( this . atimeMs ) ;
466
- this . mtime = dateFromMs ( this . mtimeMs ) ;
467
- this . ctime = dateFromMs ( this . ctimeMs ) ;
468
- this . birthtime = dateFromMs ( this . birthtimeMs ) ;
469
466
}
470
467
471
468
ObjectSetPrototypeOf ( BigIntStats . prototype , StatsBase . prototype ) ;
472
469
ObjectSetPrototypeOf ( BigIntStats , StatsBase ) ;
473
470
471
+ ObjectDefineProperty ( BigIntStats . prototype , 'atime' , {
472
+ __proto__ : null ,
473
+ enumerable : true ,
474
+ get : function ( ) {
475
+ const value = dateFromMs ( this . atimeMs ) ;
476
+ ObjectDefineProperty ( this , 'atime' , { __proto__ : null , value } ) ;
477
+ return this . atime ;
478
+ } ,
479
+ } ) ;
480
+
481
+ ObjectDefineProperty ( BigIntStats . prototype , 'mtime' , {
482
+ __proto__ : null ,
483
+ enumerable : true ,
484
+ get : function ( ) {
485
+ const value = dateFromMs ( this . mtimeMs ) ;
486
+ ObjectDefineProperty ( this , 'mtime' , { __proto__ : null , value } ) ;
487
+ return this . mtime ;
488
+ } ,
489
+ } ) ;
490
+
491
+ ObjectDefineProperty ( BigIntStats . prototype , 'ctime' , {
492
+ __proto__ : null ,
493
+ enumerable : true ,
494
+ get : function ( ) {
495
+ const value = dateFromMs ( this . ctimeMs ) ;
496
+ ObjectDefineProperty ( this , 'ctime' , { __proto__ : null , value } ) ;
497
+ return this . ctime ;
498
+ } ,
499
+ } ) ;
500
+
501
+ ObjectDefineProperty ( BigIntStats . prototype , 'birthtime' , {
502
+ __proto__ : null ,
503
+ enumerable : true ,
504
+ get : function ( ) {
505
+ const value = dateFromMs ( this . birthtimeMs ) ;
506
+ ObjectDefineProperty ( this , 'birthtime' , { __proto__ : null , value } ) ;
507
+ return this . birthtime ;
508
+ } ,
509
+ } ) ;
510
+
474
511
BigIntStats . prototype . _checkModeProperty = function ( property ) {
475
512
if ( isWindows && ( property === S_IFIFO || property === S_IFBLK ||
476
513
property === S_IFSOCK ) ) {
@@ -488,15 +525,51 @@ function Stats(dev, mode, nlink, uid, gid, rdev, blksize,
488
525
this . mtimeMs = mtimeMs ;
489
526
this . ctimeMs = ctimeMs ;
490
527
this . birthtimeMs = birthtimeMs ;
491
- this . atime = dateFromMs ( atimeMs ) ;
492
- this . mtime = dateFromMs ( mtimeMs ) ;
493
- this . ctime = dateFromMs ( ctimeMs ) ;
494
- this . birthtime = dateFromMs ( birthtimeMs ) ;
495
528
}
496
529
497
530
ObjectSetPrototypeOf ( Stats . prototype , StatsBase . prototype ) ;
498
531
ObjectSetPrototypeOf ( Stats , StatsBase ) ;
499
532
533
+ ObjectDefineProperty ( Stats . prototype , 'atime' , {
534
+ __proto__ : null ,
535
+ enumerable : true ,
536
+ get : function ( ) {
537
+ const value = dateFromMs ( this . atimeMs ) ;
538
+ ObjectDefineProperty ( this , 'atime' , { __proto__ : null , value } ) ;
539
+ return this . atime ;
540
+ } ,
541
+ } ) ;
542
+
543
+ ObjectDefineProperty ( Stats . prototype , 'mtime' , {
544
+ __proto__ : null ,
545
+ enumerable : true ,
546
+ get : function ( ) {
547
+ const value = dateFromMs ( this . mtimeMs ) ;
548
+ ObjectDefineProperty ( this , 'mtime' , { __proto__ : null , value } ) ;
549
+ return this . mtime ;
550
+ } ,
551
+ } ) ;
552
+
553
+ ObjectDefineProperty ( Stats . prototype , 'ctime' , {
554
+ __proto__ : null ,
555
+ enumerable : true ,
556
+ get : function ( ) {
557
+ const value = dateFromMs ( this . ctimeMs ) ;
558
+ ObjectDefineProperty ( this , 'ctime' , { __proto__ : null , value } ) ;
559
+ return this . ctime ;
560
+ } ,
561
+ } ) ;
562
+
563
+ ObjectDefineProperty ( Stats . prototype , 'birthtime' , {
564
+ __proto__ : null ,
565
+ enumerable : true ,
566
+ get : function ( ) {
567
+ const value = dateFromMs ( this . birthtimeMs ) ;
568
+ ObjectDefineProperty ( this , 'birthtime' , { __proto__ : null , value } ) ;
569
+ return this . birthtime ;
570
+ } ,
571
+ } ) ;
572
+
500
573
// HACK: Workaround for https://github.com/standard-things/esm/issues/821.
501
574
// TODO(ronag): Remove this as soon as `esm` publishes a fixed version.
502
575
Stats . prototype . isFile = StatsBase . prototype . isFile ;
0 commit comments