cordova-plugin-file-electron
Advanced tools
Comparing version
{ | ||
"name": "cordova-plugin-file-electron", | ||
"version": "7.0.1", | ||
"version": "7.0.2", | ||
"description": "Cordova File Plugin (Electron)", | ||
@@ -5,0 +5,0 @@ "types": "./types/index.d.ts", |
@@ -228,9 +228,3 @@ /* | ||
return { | ||
name: newFileEntry.name, | ||
fullPath: fullPath, | ||
size: 0, | ||
lastModifiedDate: new Date(), | ||
storagePath: fullPath | ||
} | ||
return toFileEntry(fullPath); | ||
} else if (options.create === true && stats) { | ||
@@ -243,9 +237,4 @@ // https://nodejs.org/docs/latest-v10.x/api/fs.html#fs_fs_open_path_flags_mode_callback | ||
return { | ||
name: nodePath.basename(fullPath), | ||
fullPath: fullPath, | ||
size: 0, | ||
lastModifiedDate: new Date(), | ||
storagePath: fullPath | ||
} | ||
return toFileEntry(fullPath); | ||
} else { | ||
@@ -257,9 +246,3 @@ if (errorCallback) { | ||
return { | ||
name: newFileEntry.name, | ||
fullPath: fullPath, | ||
size: 0, | ||
lastModifiedDate: new Date(), | ||
storagePath: fullPath | ||
} | ||
return toFileEntry(fullPath); | ||
} else if ((!options.create || options.create === false) && !stats) { | ||
@@ -280,9 +263,3 @@ // If create is not true and the path doesn't exist, getFile must fail. | ||
return { | ||
name: stats.name, | ||
fullPath: fullPath, | ||
size: 0, | ||
lastModifiedDate: new Date(), | ||
storagePath: fullPath | ||
} | ||
return toFileEntry(fullPath); | ||
} | ||
@@ -363,9 +340,11 @@ } catch(e) { | ||
// log(JSON.stringify(stats)); | ||
return { | ||
const name = nodePath.basename(baseURLstr); | ||
let metadata = { | ||
size: stats.size, | ||
type: getMimeTypeFromFile(stats.name), //"text/directory", // inputURL.isDirectory ? "text/directory" : resourceApi.getMimeType(toNativeUri(inputURL))); | ||
name: stats.name, // new File(inputURL.path).getName()); | ||
type: getMimeTypeFromFile(name), //"text/directory", // inputURL.isDirectory ? "text/directory" : resourceApi.getMimeType(toNativeUri(inputURL))); | ||
name: name, // new File(inputURL.path).getName()); | ||
fullPath: baseURLstr, // inputURL.path | ||
lastModifiedDate: stats.mtime | ||
} | ||
return metadata; | ||
} catch (e) { | ||
@@ -571,2 +550,13 @@ return null; | ||
const toFileEntry = (fullPath) => { | ||
const name = nodePath.basename(fullPath); | ||
return { | ||
name: name, | ||
fullPath: fullPath, | ||
size: 0, | ||
lastModifiedDate: new Date(), | ||
storagePath: fullPath | ||
} | ||
} | ||
// https://cordova.apache.org/docs/en/11.x/reference/cordova-plugin-file/index.html | ||
@@ -573,0 +563,0 @@ module.exports = { |
639631
-0.06%7681
-0.16%