FileSystemDirectoryHandle.removeEntry()
Draft: This page is not complete.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
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
FileSystemDirectoryHandle.removeEntry(name).then...
Parameters
- name
-
A
USVStringrepresenting theFileSystemHandle.nameof the entry you wish to remove. - options Optional
-
An optional object containing options, which are as follows:
-
recursive: ABoolean. Defaultfalse. When set totrueentries will be removed recursively.
-
Return value
A Promise which resolves with undefined.
Exceptions
-
TypeErrorDOMException -
Thrown if the name is not a valid string or contains characters not allowed on the file system
-
NotAllowedErrorDOMException -
Thrown if
PermissionStatusis not 'granted'. -
InvalidModificationErrorDOMException -
Thrown if
recursiveis set to false and the entry to be removed has children. -
NotFoundErrorDOMException -
Thrown if an entry name is not found or matched
Examples
The following example removes an entry within the directory handle.
const entryName = 'entryToRemove'; // assuming we have a directory handle: 'currentDirHandle' currentDirHandle.removeEntry(entryName).then( () => { // code to run if removing was successful } );
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 |
No |
No |
72 |
No |
No |
86 |
No |
No |
No |
14.0 |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/removeEntry