mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-03 16:03:02 +08:00
parent
5d091d21fb
commit
b4583271b8
@ -480,13 +480,13 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} dir Name of directory to check
|
||||
* @returns {Promise<boolean> | Promise<FileError>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
|
||||
* @returns {Promise<boolean>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
|
||||
*/
|
||||
static checkDir(path: string, dir: string): Promise<boolean> | Promise<FileError> {
|
||||
static checkDir(path: string, dir: string): Promise<boolean> {
|
||||
if ((/^\//.test(dir))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
let fullpath = path + dir;
|
||||
@ -504,13 +504,13 @@ export class File {
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} dirName Name of directory to create
|
||||
* @param {boolean} replace If true, replaces file with same name. If false returns error
|
||||
* @returns {Promise<DirectoryEntry> | Promise<FileError>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
|
||||
* @returns {Promise<DirectoryEntry>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
|
||||
*/
|
||||
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry> | Promise<FileError> {
|
||||
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
let options: Flags = {
|
||||
@ -532,13 +532,13 @@ export class File {
|
||||
*
|
||||
* @param {string} path The path to the directory
|
||||
* @param {string} dirName The directory name
|
||||
* @returns {Promise<RemoveResult> | Promise<FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
* @returns {Promise<RemoveResult>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
*/
|
||||
static removeDir(path: string, dirName: string): Promise<RemoveResult> | Promise<FileError> {
|
||||
static removeDir(path: string, dirName: string): Promise<RemoveResult> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
@ -557,15 +557,15 @@ export class File {
|
||||
* @param {string} dirName The source directory name
|
||||
* @param {string} newPath The destionation path to the directory
|
||||
* @param {string} newDirName The destination directory name
|
||||
* @returns {Promise<DirectoryEntry|Entry> | Promise<FileError>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
|
||||
* @returns {Promise<DirectoryEntry|Entry>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
|
||||
*/
|
||||
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry> | Promise<FileError> {
|
||||
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry> {
|
||||
newDirName = newDirName || dirName;
|
||||
|
||||
if ((/^\//.test(newDirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
@ -587,13 +587,13 @@ export class File {
|
||||
* @param {string} dirName Name of directory to copy
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newDirName New name of directory to copy to (leave blank to remain the same)
|
||||
* @returns {Promise<Entry> | Promise<FileError>} Returns a Promise that resolves to the new Entry object or rejects with an error.
|
||||
* @returns {Promise<Entry>} Returns a Promise that resolves to the new Entry object or rejects with an error.
|
||||
*/
|
||||
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry> | Promise<FileError> {
|
||||
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry> {
|
||||
if ((/^\//.test(newDirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
@ -660,13 +660,13 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file to check
|
||||
* @returns {Promise<boolean> | Promise<FileError>} Returns a Promise that resolves with a boolean or rejects with an error.
|
||||
* @returns {Promise<boolean>} Returns a Promise that resolves with a boolean or rejects with an error.
|
||||
*/
|
||||
static checkFile(path: string, file: string): Promise<boolean> | Promise<FileError> {
|
||||
static checkFile(path: string, file: string): Promise<boolean> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveLocalFilesystemUrl(path + file)
|
||||
@ -689,13 +689,13 @@ export class File {
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} fileName Name of file to create
|
||||
* @param {boolean} replace If true, replaces file with same name. If false returns error
|
||||
* @returns {Promise<FileEntry> | Promise<FileError>} Returns a Promise that resolves to a FileEntry or rejects with an error.
|
||||
* @returns {Promise<FileEntry>} Returns a Promise that resolves to a FileEntry or rejects with an error.
|
||||
*/
|
||||
static createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry> | Promise<FileError> {
|
||||
static createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
let options: Flags = {
|
||||
@ -717,13 +717,13 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} fileName Name of file to remove
|
||||
* @returns {Promise<RemoveResult> | Promise<FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
* @returns {Promise<RemoveResult>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
*/
|
||||
static removeFile(path: string, fileName: string): Promise<RemoveResult> | Promise<FileError> {
|
||||
static removeFile(path: string, fileName: string): Promise<RemoveResult> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
@ -806,13 +806,13 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<string> | Promise<FileError>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
|
||||
*/
|
||||
static readAsText(path: string, file: string): Promise<string> | Promise<FileError> {
|
||||
static readAsText(path: string, file: string): Promise<string> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
@ -847,13 +847,13 @@ export class File {
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<string> | Promise<FileError>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
|
||||
*/
|
||||
static readAsDataURL(path: string, file: string): Promise<string> | Promise<FileError> {
|
||||
static readAsDataURL(path: string, file: string): Promise<string> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
@ -889,13 +889,13 @@ export class File {
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<string> | Promise<FileError>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
|
||||
*/
|
||||
static readAsBinaryString(path: string, file: string): Promise<string> | Promise<FileError> {
|
||||
static readAsBinaryString(path: string, file: string): Promise<string> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
@ -930,13 +930,13 @@ export class File {
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<ArrayBuffer> | Promise<FileError>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
|
||||
* @returns {Promise<ArrayBuffer>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
|
||||
*/
|
||||
static readAsArrayBuffer(path: string, file: string): Promise<ArrayBuffer> | Promise<FileError> {
|
||||
static readAsArrayBuffer(path: string, file: string): Promise<ArrayBuffer> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
@ -973,15 +973,15 @@ export class File {
|
||||
* @param {string} fileName Name of file to move
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newFileName New name of file to move to (leave blank to remain the same)
|
||||
* @returns {Promise<Entry> | Promise<FileError>} Returns a Promise that resolves to the new Entry or rejects with an error.
|
||||
* @returns {Promise<Entry>} Returns a Promise that resolves to the new Entry or rejects with an error.
|
||||
*/
|
||||
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> | Promise<FileError> {
|
||||
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> {
|
||||
newFileName = newFileName || fileName;
|
||||
|
||||
if ((/^\//.test(newFileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
@ -1003,15 +1003,15 @@ export class File {
|
||||
* @param {string} fileName Name of file to copy
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newFileName New name of file to copy to (leave blank to remain the same)
|
||||
* @returns {Promise<Entry> | Promise<FileError>} Returns a Promise that resolves to an Entry or rejects with an error.
|
||||
* @returns {Promise<Entry>} Returns a Promise that resolves to an Entry or rejects with an error.
|
||||
*/
|
||||
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> | Promise<FileError> {
|
||||
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> {
|
||||
newFileName = newFileName || fileName;
|
||||
|
||||
if ((/^\//.test(newFileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
|
Loading…
Reference in New Issue
Block a user