summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/stat.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/js/stat.ts b/js/stat.ts
index 49902b396..3193794a5 100644
--- a/js/stat.ts
+++ b/js/stat.ts
@@ -8,6 +8,7 @@ import { assert } from "./util";
* A FileInfo describes a file and is returned by `stat`, `lstat`,
* `statSync`, `lstatSync`.
*/
+// TODO FileInfo should be an interface not a class.
export class FileInfo {
private readonly _isFile: boolean;
private readonly _isSymlink: boolean;
@@ -31,12 +32,18 @@ export class FileInfo {
* be available on all platforms.
*/
created: number | null;
+ /**
+ * The underlying raw st_mode bits that contain the standard Unix permissions
+ * for this file/directory. TODO Match behavior with Go on windows for mode.
+ */
+ mode: number | null;
/* @internal */
constructor(private _msg: fbs.StatRes) {
const modified = this._msg.modified().toFloat64();
const accessed = this._msg.accessed().toFloat64();
const created = this._msg.created().toFloat64();
+ const mode = this._msg.mode(); // negative for invalid mode (Windows)
this._isFile = this._msg.isFile();
this._isSymlink = this._msg.isSymlink();
@@ -44,6 +51,7 @@ export class FileInfo {
this.modified = modified ? modified : null;
this.accessed = accessed ? accessed : null;
this.created = created ? created : null;
+ this.mode = mode >= 0 ? mode : null; // null if invalid mode (Windows)
}
/**