Merge pull request #379 from josephroque/master

Make mtime optional on ReadDirItem, change utime to mtime on StatResult
This commit is contained in:
Hagen Hübel 2017-11-06 23:20:09 +01:00 committed by GitHub
commit f16c51b1e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,7 @@ type MkdirOptions = {
type ReadDirItem = { type ReadDirItem = {
ctime: ?Date; // The creation date of the file (iOS only) ctime: ?Date; // The creation date of the file (iOS only)
mtime: Date; // The last modified date of the file mtime: ?Date; // The last modified date of the file
name: string; // The name of the item name: string; // The name of the item
path: string; // The absolute path to the item path: string; // The absolute path to the item
size: string; // Size in bytes size: string; // Size in bytes
@ -47,7 +47,7 @@ type StatResult = {
size: string; // Size in bytes size: string; // Size in bytes
mode: number; // UNIX file mode mode: number; // UNIX file mode
ctime: number; // Created date ctime: number; // Created date
utime: number; // Updated date mtime: number; // Last modified date
isFile: () => boolean; // Is the file just a file? isFile: () => boolean; // Is the file just a file?
isDirectory: () => boolean; // Is the file a directory? isDirectory: () => boolean; // Is the file a directory?
}; };
@ -165,7 +165,7 @@ function readDirGeneric(dirpath: string, command: Function) {
return command(normalizeFilePath(dirpath)).then(files => { return command(normalizeFilePath(dirpath)).then(files => {
return files.map(file => ({ return files.map(file => ({
ctime: file.ctime && new Date(file.ctime * 1000) || null, ctime: file.ctime && new Date(file.ctime * 1000) || null,
mtime: new Date(file.mtime * 1000), mtime: file.mtime && new Date(file.mtime * 1000) || null,
name: file.name, name: file.name,
path: file.path, path: file.path,
size: file.size, size: file.size,