From 5c92455ee9868f704354de6f36c1c3e91daee400 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 20:30:14 -0400 Subject: [PATCH] feat(file): getFile and getDirectory are now public closes #657 --- src/plugins/file.ts | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/plugins/file.ts b/src/plugins/file.ts index 588bc89fab..794e2d8ad2 100644 --- a/src/plugins/file.ts +++ b/src/plugins/file.ts @@ -959,13 +959,13 @@ export class File { /** * Resolves a local file system URL - * @param furl {string} file system url + * @param fileUrl {string} file system url * @returns {Promise} */ - static resolveLocalFilesystemUrl(furl: string): Promise { + static resolveLocalFilesystemUrl(fileUrl: string): Promise { return new Promise((resolve, reject) => { try { - window.resolveLocalFileSystemURL(furl, (entry) => { + window.resolveLocalFileSystemURL(fileUrl, (entry) => { resolve(entry); }, (err) => { File.fillErrorMessage(err); @@ -980,11 +980,11 @@ export class File { /** * Resolves a local directory url - * @param durl {string} directory system url + * @param directoryUrl {string} directory system url * @returns {Promise} */ - static resolveDirectoryUrl(durl: string): Promise { - return File.resolveLocalFilesystemUrl(durl) + static resolveDirectoryUrl(directoryUrl: string): Promise { + return File.resolveLocalFilesystemUrl(directoryUrl) .then((de) => { if (de.isDirectory) { return de; @@ -997,12 +997,16 @@ export class File { } /** - * @private + * Get a directory + * @param directoryEntry {DirectoryEntry} Directory entry, obtained by resolveDirectoryUrl method + * @param directoryName {string} Directory name + * @param flags {Flags} Options + * @returns {Promise} */ - private static getDirectory(fse: DirectoryEntry, dn: string, flags: Flags): Promise { + static getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise { return new Promise((resolve, reject) => { try { - fse.getDirectory(dn, flags, (de) => { + directoryEntry.getDirectory(directoryName, flags, (de) => { resolve(de); }, (err) => { File.fillErrorMessage(err); @@ -1016,12 +1020,16 @@ export class File { } /** - * @private + * Get a file + * @param directoryEntry {DirectoryEntry} Directory entry, obtained by resolveDirectoryUrl method + * @param fileName {string} File name + * @param flags {Flags} Options + * @returns {Promise} */ - private static getFile(fse: DirectoryEntry, fn: string, flags: Flags): Promise { + static getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise { return new Promise((resolve, reject) => { try { - fse.getFile(fn, flags, resolve, (err) => { + directoryEntry.getFile(fileName, flags, resolve, (err) => { File.fillErrorMessage(err); reject(err); });