Skip to content

Commit 5e0af48

Browse files
Make mtime optional on ReadDirItem, change utime to mtime on StatResult
Android and iOS both set for stat method, so this type declaration must be updated. Making mtime optional on ReadDirItem fixes #378
1 parent fa0c78b commit 5e0af48

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

FS.common.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type MkdirOptions = {
3333

3434
type ReadDirItem = {
3535
ctime: ?Date; // The creation date of the file (iOS only)
36-
mtime: Date; // The last modified date of the file
36+
mtime: ?Date; // The last modified date of the file
3737
name: string; // The name of the item
3838
path: string; // The absolute path to the item
3939
size: string; // Size in bytes
@@ -47,7 +47,7 @@ type StatResult = {
4747
size: string; // Size in bytes
4848
mode: number; // UNIX file mode
4949
ctime: number; // Created date
50-
utime: number; // Updated date
50+
mtime: number; // Last modified date
5151
isFile: () => boolean; // Is the file just a file?
5252
isDirectory: () => boolean; // Is the file a directory?
5353
};
@@ -165,7 +165,7 @@ function readDirGeneric(dirpath: string, command: Function) {
165165
return command(normalizeFilePath(dirpath)).then(files => {
166166
return files.map(file => ({
167167
ctime: file.ctime && new Date(file.ctime * 1000) || null,
168-
mtime: new Date(file.mtime * 1000),
168+
mtime: file.mtime && new Date(file.mtime * 1000) || null,
169169
name: file.name,
170170
path: file.path,
171171
size: file.size,

0 commit comments

Comments
 (0)