SecureErase (securely delete file)

function SecureErase(name: string, passes: number): boolean

This function tries to delete the name file from the local file-system using a secure erasure algorithm. This means that the file will be overwritten with crypto-secure pseudo-random data before it’s actually deleted from the storage medium. For this reason, depending on the size of the file, this function may take a while to complete.

The second parameter (passes) is optional and specifies how many times the file needs to be overwritten with crypto-secure pseudo-random data before the actual deletion occurs. If left unspecified, the file will be overwritten only once and then deleted.

As almost any other function in the SyncJS, this function returns a boolean value: true if it succeeds, false if it fails.

Example (on Windows, without optional parameter):

{
  SecureErase('C:\\Data\\SomeFile.docx');
}

Example (on Linux, optional parameter to specify that the file should be overwritten 3 times):

{
  SecureErase('/home/docs/SomeFile.pdf', 3);
}