fileErase
Category: File Operations
Namespace: web.files.fileErase
Description
Erases (deletes) a file from the file system. This is functionally identical to deleteFile and is provided for API compatibility.
Syntax
const success = await web.files.fileErase({
fileName: 'path/to/file.txt'
});
Parameters
- fileName (required) - Path to the file to erase (relative or absolute)
Returns
Promise<boolean> - Returns a promise that resolves with true if the file was erased successfully, false otherwise
Examples
Simple example
const success = await web.files.fileErase({
fileName: 'temp.txt'
});
if (success) {
console.log('File erased successfully');
}
Clean up cache files
const cacheFiles = ['cache1.dat', 'cache2.dat', 'cache3.dat'];
for (const file of cacheFiles) {
await web.files.fileErase({ fileName: file });
}
console.log('Cache cleared');
Use Cases
- Delete temporary files
- Remove cache files
- Clean up old data files
- Erase user-requested files
Notes
- Note: This API is functionally identical to
web.files.deleteFile() - Use
deleteFile()for consistency with modern naming conventions - WARNING: Deletion is permanent and cannot be undone
- Files are not sent to the Recycle Bin
- Returns
falseif the file doesn't exist or is locked