@@ -196,81 +196,13 @@ function Stats(
196
196
this . ino = ino ;
197
197
this . size = size ;
198
198
this . blocks = blocks ;
199
- this . _atim_msec = atim_msec ;
200
- this . _mtim_msec = mtim_msec ;
201
- this . _ctim_msec = ctim_msec ;
202
- this . _birthtim_msec = birthtim_msec ;
199
+ this . atime = new Date ( atim_msec + 0.5 ) ;
200
+ this . mtime = new Date ( mtim_msec + 0.5 ) ;
201
+ this . ctime = new Date ( ctim_msec + 0.5 ) ;
202
+ this . birthtime = new Date ( birthtim_msec + 0.5 ) ;
203
203
}
204
204
fs . Stats = Stats ;
205
205
206
- // defining the properties in this fashion (explicitly with no loop or factory)
207
- // has been shown to be the most performant on V8 contemp.
208
- // Ref: https://github.com/nodejs/node/pull/12818
209
- // + 0.5 is added to the Dates to protect values from being rounded down
210
- // Ref: https://github.com/nodejs/node/pull/12607
211
- Object . defineProperties ( Stats . prototype , {
212
- atime : {
213
- configurable : true ,
214
- enumerable : true ,
215
- get ( ) {
216
- return this . _atime !== undefined ?
217
- this . _atime :
218
- ( this . _atime = new Date ( this . _atim_msec + 0.5 ) ) ;
219
- } ,
220
- set ( value ) { return this . _atime = value ; }
221
- } ,
222
- mtime : {
223
- configurable : true ,
224
- enumerable : true ,
225
- get ( ) {
226
- return this . _mtime !== undefined ?
227
- this . _mtime :
228
- ( this . _mtime = new Date ( this . _mtim_msec + 0.5 ) ) ;
229
- } ,
230
- set ( value ) { return this . _mtime = value ; }
231
- } ,
232
- ctime : {
233
- configurable : true ,
234
- enumerable : true ,
235
- get ( ) {
236
- return this . _ctime !== undefined ?
237
- this . _ctime :
238
- ( this . _ctime = new Date ( this . _ctim_msec + 0.5 ) ) ;
239
- } ,
240
- set ( value ) { return this . _ctime = value ; }
241
- } ,
242
- birthtime : {
243
- configurable : true ,
244
- enumerable : true ,
245
- get ( ) {
246
- return this . _birthtime !== undefined ?
247
- this . _birthtime :
248
- ( this . _birthtime = new Date ( this . _birthtim_msec + 0.5 ) ) ;
249
- } ,
250
- set ( value ) { return this . _birthtime = value ; }
251
- } ,
252
- } ) ;
253
-
254
- Stats . prototype . toJSON = function toJSON ( ) {
255
- return {
256
- dev : this . dev ,
257
- mode : this . mode ,
258
- nlink : this . nlink ,
259
- uid : this . uid ,
260
- gid : this . gid ,
261
- rdev : this . rdev ,
262
- blksize : this . blksize ,
263
- ino : this . ino ,
264
- size : this . size ,
265
- blocks : this . blocks ,
266
- atime : this . atime ,
267
- ctime : this . ctime ,
268
- mtime : this . mtime ,
269
- birthtime : this . birthtime
270
- } ;
271
- } ;
272
-
273
-
274
206
Stats . prototype . _checkModeProperty = function ( property ) {
275
207
return ( ( this . mode & S_IFMT ) === property ) ;
276
208
} ;
0 commit comments