1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
|
/**
* @license
* Copyright The Closure Library Authors.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Wrappers for HTML5 Entry objects. These are all in the same
* file to avoid circular dependency issues.
*
* When adding or modifying functionality in this namespace, be sure to update
* the mock counterparts in goog.testing.fs.
*/
goog.provide('goog.fs.DirectoryEntry');
goog.provide('goog.fs.DirectoryEntry.Behavior');
goog.provide('goog.fs.Entry');
goog.provide('goog.fs.FileEntry');
goog.requireType('goog.async.Deferred');
goog.requireType('goog.fs.FileSystem');
goog.requireType('goog.fs.FileWriter');
/**
* The interface for entries in the filesystem.
* @interface
*/
goog.fs.Entry = function() {};
/**
* @return {boolean} Whether or not this entry is a file.
*/
goog.fs.Entry.prototype.isFile = function() {};
/**
* @return {boolean} Whether or not this entry is a directory.
*/
goog.fs.Entry.prototype.isDirectory = function() {};
/**
* @return {string} The name of this entry.
*/
goog.fs.Entry.prototype.getName = function() {};
/**
* @return {string} The full path to this entry.
*/
goog.fs.Entry.prototype.getFullPath = function() {};
/**
* @return {!goog.fs.FileSystem} The filesystem backing this entry.
*/
goog.fs.Entry.prototype.getFileSystem = function() {};
/**
* Retrieves the last modified date for this entry.
*
* @return {!goog.async.Deferred} The deferred Date for this entry. If an error
* occurs, the errback is called with a {@link goog.fs.Error}.
*/
goog.fs.Entry.prototype.getLastModified = function() {};
/**
* Retrieves the metadata for this entry.
*
* @return {!goog.async.Deferred} The deferred Metadata for this entry. If an
* error occurs, the errback is called with a {@link goog.fs.Error}.
*/
goog.fs.Entry.prototype.getMetadata = function() {};
/**
* Move this entry to a new location.
*
* @param {!goog.fs.DirectoryEntry} parent The new parent directory.
* @param {string=} opt_newName The new name of the entry. If omitted, the entry
* retains its original name.
* @return {!goog.async.Deferred} The deferred {@link goog.fs.FileEntry} or
* {@link goog.fs.DirectoryEntry} for the new entry. If an error occurs, the
* errback is called with a {@link goog.fs.Error}.
*/
goog.fs.Entry.prototype.moveTo = function(parent, opt_newName) {};
/**
* Copy this entry to a new location.
*
* @param {!goog.fs.DirectoryEntry} parent The new parent directory.
* @param {string=} opt_newName The name of the new entry. If omitted, the new
* entry has the same name as the original.
* @return {!goog.async.Deferred} The deferred {@link goog.fs.FileEntry} or
* {@link goog.fs.DirectoryEntry} for the new entry. If an error occurs, the
* errback is called with a {@link goog.fs.Error}.
*/
goog.fs.Entry.prototype.copyTo = function(parent, opt_newName) {};
/**
* Wrap an HTML5 entry object in an appropriate subclass instance.
*
* @param {!Entry} entry The underlying Entry object.
* @return {!goog.fs.Entry} The appropriate subclass wrapper.
* @protected
*/
goog.fs.Entry.prototype.wrapEntry = function(entry) {};
/**
* Get the URL for this file.
*
* @param {string=} opt_mimeType The MIME type that will be served for the URL.
* @return {string} The URL.
*/
goog.fs.Entry.prototype.toUrl = function(opt_mimeType) {};
/**
* Get the URI for this file.
*
* @deprecated Use {@link #toUrl} instead.
* @param {string=} opt_mimeType The MIME type that will be served for the URI.
* @return {string} The URI.
*/
goog.fs.Entry.prototype.toUri = function(opt_mimeType) {};
/**
* Remove this entry.
*
* @return {!goog.async.Deferred} A deferred object. If the removal succeeds,
* the callback is called with true. If an error occurs, the errback is
* called a {@link goog.fs.Error}.
*/
goog.fs.Entry.prototype.remove = function() {};
/**
* Gets the parent directory.
*
* @return {!goog.async.Deferred} The deferred {@link goog.fs.DirectoryEntry}.
* If an error occurs, the errback is called with a {@link goog.fs.Error}.
*/
goog.fs.Entry.prototype.getParent = function() {};
/**
* A directory in a local FileSystem.
*
* @interface
* @extends {goog.fs.Entry}
*/
goog.fs.DirectoryEntry = function() {};
/**
* Behaviors for getting files and directories.
* @enum {number}
*/
goog.fs.DirectoryEntry.Behavior = {
/**
* Get the file if it exists, error out if it doesn't.
*/
DEFAULT: 1,
/**
* Get the file if it exists, create it if it doesn't.
*/
CREATE: 2,
/**
* Error out if the file exists, create it if it doesn't.
*/
CREATE_EXCLUSIVE: 3
};
/**
* Get a file in the directory.
*
* @param {string} path The path to the file, relative to this directory.
* @param {goog.fs.DirectoryEntry.Behavior=} opt_behavior The behavior for
* handling an existing file, or the lack thereof.
* @return {!goog.async.Deferred} The deferred {@link goog.fs.FileEntry}. If an
* error occurs, the errback is called with a {@link goog.fs.Error}.
*/
goog.fs.DirectoryEntry.prototype.getFile = function(path, opt_behavior) {};
/**
* Get a directory within this directory.
*
* @param {string} path The path to the directory, relative to this directory.
* @param {goog.fs.DirectoryEntry.Behavior=} opt_behavior The behavior for
* handling an existing directory, or the lack thereof.
* @return {!goog.async.Deferred} The deferred {@link goog.fs.DirectoryEntry}.
* If an error occurs, the errback is called a {@link goog.fs.Error}.
*/
goog.fs.DirectoryEntry.prototype.getDirectory = function(path, opt_behavior) {};
/**
* Opens the directory for the specified path, creating the directory and any
* intermediate directories as necessary.
*
* @param {string} path The directory path to create. May be absolute or
* relative to the current directory. The parent directory ".." and current
* directory "." are supported.
* @return {!goog.async.Deferred} A deferred {@link goog.fs.DirectoryEntry} for
* the requested path. If an error occurs, the errback is called with a
* {@link goog.fs.Error}.
*/
goog.fs.DirectoryEntry.prototype.createPath = function(path) {};
/**
* Gets a list of all entries in this directory.
*
* @return {!goog.async.Deferred} The deferred list of {@link goog.fs.Entry}
* results. If an error occurs, the errback is called with a
* {@link goog.fs.Error}.
*/
goog.fs.DirectoryEntry.prototype.listDirectory = function() {};
/**
* Removes this directory and all its contents.
*
* @return {!goog.async.Deferred} A deferred object. If the removal succeeds,
* the callback is called with true. If an error occurs, the errback is
* called a {@link goog.fs.Error}.
*/
goog.fs.DirectoryEntry.prototype.removeRecursively = function() {};
/**
* A file in a local filesystem.
*
* @interface
* @extends {goog.fs.Entry}
*/
goog.fs.FileEntry = function() {};
/**
* Create a writer for writing to the file.
*
* @return {!goog.async.Deferred<!goog.fs.FileWriter>} If an error occurs, the
* errback is called with a {@link goog.fs.Error}.
*/
goog.fs.FileEntry.prototype.createWriter = function() {};
/**
* Get the file contents as a File blob.
*
* @return {!goog.async.Deferred<!File>} If an error occurs, the errback is
* called with a {@link goog.fs.Error}.
*/
goog.fs.FileEntry.prototype.file = function() {};
|