FileSystemDirectoryHandle: removeEntry() method
The removeEntry()
method of the FileSystemDirectoryHandle
interface attempts to remove an entry if the directory handle contains a file or directory called the name specified.
Syntax
removeEntry(name)
removeEntry(name, options)
Parameters
-
name
-
A string representing the FileSystemHandle.name
of the entry you wish to remove.
options
Optional
-
An optional object containing options, which are as follows:
-
recursive
-
A boolean value, which defaults to false
. When set to true
entries will be removed recursively.
Return value
A Promise
which resolves with undefined
.
Exceptions
-
TypeError
-
Thrown if the name is not a valid string or contains characters not allowed on the file system
NotAllowedError
DOMException
-
Thrown if PermissionStatus
is not 'granted'.
InvalidModificationError
DOMException
-
Thrown if recursive
is set to false and the entry to be removed has children.
NotFoundError
DOMException
-
Thrown if an entry name is not found or matched
Examples
The following example removes an entry within the directory handle.
const entryName = "entryToRemove";
currentDirHandle.removeEntry(entryName).then(() => {
});
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
removeEntry |
86 |
86 |
111 |
No |
72 |
15.2 |
No |
86 |
111 |
61 |
15.2 |
14.0 |
See also