@lvce-editor/file-system-process 5.14.0 → 5.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # File System Process
2
2
 
3
- File System Process
3
+ File System Process
package/dist/index.js CHANGED
@@ -1797,6 +1797,22 @@ const remove = async uri => {
1797
1797
  throw new VError(error, `Failed to remove "${uri}"`);
1798
1798
  }
1799
1799
  };
1800
+ const forceRemove = async uri => {
1801
+ assertUri(uri);
1802
+ const path = fileURLToPath(uri);
1803
+ if (!isOkayToRemove(path)) {
1804
+ throw new Error('Cannot remove a filesystem root or home directory');
1805
+ }
1806
+ try {
1807
+ const stats = await fs.lstat(path);
1808
+ await fs.rm(path, {
1809
+ force: false,
1810
+ recursive: stats.isDirectory() && !stats.isSymbolicLink()
1811
+ });
1812
+ } catch (error) {
1813
+ throw new VError(error, `Failed to permanently remove "${uri}"`);
1814
+ }
1815
+ };
1800
1816
  const toPrettyDirent = dirent => {
1801
1817
  return {
1802
1818
  name: dirent.name,
@@ -1976,6 +1992,7 @@ const commandMap = {
1976
1992
  'FileSystem.chmod': chmod,
1977
1993
  'FileSystem.copy': copy,
1978
1994
  'FileSystem.exists': exists,
1995
+ 'FileSystem.forceRemove': forceRemove,
1979
1996
  'FileSystem.getFileHash': getFileHash,
1980
1997
  'FileSystem.getFileHashes': getFileHashes,
1981
1998
  'FileSystem.getFolderSize': getFolderSize,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-system-process",
3
- "version": "5.14.0",
3
+ "version": "5.15.0",
4
4
  "description": "File System Process",
5
5
  "keywords": [
6
6
  "Lvce Editor",