Methods
(static) appendFile(path, data) → {Promise}
Appends data to file. If file does not exist - it will be created.
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | String | FileSystemFileEntry | |
| data | String | Blob | File | ArrayBuffer | 
Returns:
- Type
- Promise
(static) clear() → {Promise}
Clears whole filesystem
Returns:
- Type
- Promise
(static) copy(oldPath, newPath, optionsopt) → {Promise.<FileSystemEntry>}
Copies file or entire directory. If file or directory does not exist - error thrown.
Parameters:
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| oldPath | String | FileSystemEntry | ||||||||||||
| newPath | String | ||||||||||||
| options | Object | <optional> | Properties
 | 
Returns:
- Type
- Promise.<FileSystemEntry>
(static) createReadStream(path) → {ReadableStream}
Create a ReadableStream for reading
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | String | FileSystemFileEntry | 
Returns:
- Type
- ReadableStream
(static) createWriteStream(path) → {WritableStream}
Create a WritableStream for writing
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | String | FileSystemFileEntry | 
Returns:
- Type
- WritableStream
(static) exists(path) → {Promise.<Boolean>}
Checks that file or directory exists by provided path.
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | String | 
Returns:
- Type
- Promise.<Boolean>
(static) getEntry(path) → {Promise.<FileSystemEntry>}
Gets file or directory
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | String | FileSystemEntry | 
Returns:
- Type
- Promise.<FileSystemEntry>
(static) getRoot() → {FileSystemDirectoryEntry}
Returns root directory
Returns:
(static) getUrl(path) → {String}
Gets URL for path
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | String | FileSystemEntry | 
Returns:
- Type
- String
(static) init(optionsopt) → {Promise}
Init filesystem
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | <optional> | Properties
 | 
Returns:
- Type
- Promise
(static) isSupported() → {Boolean}
Is filesystem API supported by current browser
Returns:
- Type
- Boolean
(static) mkdir(path) → {Promise.<FileSystemDirectoryEntry>}
Recursively creates required directories in provided path.
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | String | 
Returns:
- Type
- Promise.<FileSystemDirectoryEntry>
(static) readdir(path, optionsopt) → {Promise.<Array.<FileSystemEntry>>}
Reads directory content
Parameters:
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| path | String | FileSystemDirectoryEntry | ||||||||||||
| options | Object | <optional> | Properties
 | 
Returns:
- Type
- Promise.<Array.<FileSystemEntry>>
(static) readFile(path, optionsopt) → {Promise.<String>}
Reads file content.
- options.type='Blob'returns a immutable snapshot of the file. Slower but safer.
- options.type='File'returns a mutable instance of File. Faster but may have a data race.
If file does not exist - error thrown.
Parameters:
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| path | String | FileSystemFileEntry | ||||||||||||
| options | Object | <optional> | Properties
 | 
Returns:
- Type
- Promise.<String>
(static) rename(oldPath, newPath, optionsopt) → {Promise.<FileSystemEntry>}
Renames file or directory. If source file or directory does not exist - error thrown. If target already exists - it will be overwritten.
Parameters:
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| oldPath | String | FileSystemEntry | ||||||||||||
| newPath | String | ||||||||||||
| options | Object | <optional> | Properties
 | 
Returns:
- Type
- Promise.<FileSystemEntry>
(static) rmdir(path) → {Promise}
Removes directory recursively. If directory does not exist - method does nothing without error.
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | String | FileSystemDirectoryEntry | 
Returns:
- Type
- Promise
(static) stat(path) → {Promise.<StatObject>}
Gets info about file or directory. If it does not exist - error thrown.
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | String | FileSystemEntry | 
Returns:
- Type
- Promise.<StatObject>
(static) unlink(path) → {Promise}
Removes file. If file does not exist - no error thrown.
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | String | FileSystemFileEntry | 
Returns:
- Type
- Promise
(static) usage() → {Promise.<{usedBytes, grantedBytes}>}
Gets used and granted bytes
Returns:
- Type
- Promise.<{usedBytes, grantedBytes}>
(static) writeFile(path, data) → {Promise}
Writes data to file. If file does not exist - it will be created. If file already exists - it will be overwritten.
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | String | |
| data | String | Blob | File | ArrayBuffer | 
Returns:
- Type
- Promise