30 lines
879 B
JavaScript
30 lines
879 B
JavaScript
/* IMPORT */
|
|
/* MAIN */
|
|
// An more memory-efficient representation of the useful subset of stats objects
|
|
class WatcherStats {
|
|
/* CONSTRUCTOR */
|
|
constructor(stats) {
|
|
this.ino = (stats.ino <= Number.MAX_SAFE_INTEGER) ? Number(stats.ino) : stats.ino;
|
|
this.size = Number(stats.size);
|
|
this.atimeMs = Number(stats.atimeMs);
|
|
this.mtimeMs = Number(stats.mtimeMs);
|
|
this.ctimeMs = Number(stats.ctimeMs);
|
|
this.birthtimeMs = Number(stats.birthtimeMs);
|
|
this._isFile = stats.isFile();
|
|
this._isDirectory = stats.isDirectory();
|
|
this._isSymbolicLink = stats.isSymbolicLink();
|
|
}
|
|
/* API */
|
|
isFile() {
|
|
return this._isFile;
|
|
}
|
|
isDirectory() {
|
|
return this._isDirectory;
|
|
}
|
|
isSymbolicLink() {
|
|
return this._isSymbolicLink;
|
|
}
|
|
}
|
|
/* EXPORT */
|
|
export default WatcherStats;
|