| description | The Unlink object helps you create your own custom unlink method. |
|---|
Initialize the process with file.initto retrieve file data.
const fileData = await file.init(path)
await file.random(fileData)
await file.end(fileData){% hint style="danger" %}
Unless you know what you’re doing, always end with file.end.
{% endhint %}
- fileName:
string
Mandatory to get file data.
- fileData:
{ fd: number, fileName: string, fileSize: number }
Mandatory to delete file.
- fileData:
{ fd: number, fileName: string, fileSize: number }
Help to construct a tree of erased files.
Used in mark standard.
- fileData:
{ fd: number, fileName: string, fileSize: number } - passes:
number- default:
1 - the number of times the function is executed.
- default:
Write cryptographically strong pseudo-random data.
- fileData:
{ fd: number, fileName: string, fileSize: number } - passes:
number- default:
1 - the number of times the function is executed.
- default:
Write zeroes on the whole file.
- fileData:
{ fd: number, fileName: string, fileSize: number } - passes:
number- default:
1 - the number of times the function is executed.
- default:
Write ones on the whole file.
- fileData:
{ fd: number, fileName: string, fileSize: number } - passes:
number- default:
1 - the number of times the function is executed.
- default:
- data:
number- A byte: must be between
0x00and0xFF(Hexadecimal)
- A byte: must be between
Write one byte on the whole file.
await file.byte(fileData, { data: 0x55 })- fileData:
{ fd: number, fileName: string, fileSize: number } - passes:
number- default:
1 - the number of times the function is executed.
- default:
- dataArray:
number[]- The array containing the bytes.
Write an array of bytes on the whole file.
await file.byteArray(fileData, { data: [0x92, 0x49, 0x24] })- fileData:
{ fd: number, fileName: string, fileSize: number } - data:
Object- initial:
number- initialize the counter variable.
- condition:
(i: number) => boolean- An expression to be evaluated before each loop iteration.
- increment:
(i: number) => number- The increment of the counter variable after each loop iteration.
- initial:
A for loop, write the value of the variable at each iteration.
await file.forByte(fileData, {
initial: 0x00,
condition: i => i < 0xFF,
increment: i => i + 0x11
})- fileData:
{ fd: number, fileName: string, fileSize: number } - passes:
number- default:
1 - the number of times the function is executed.
- default:
Write one cryptographically strong pseudo-random byte on the whole file.
- fileData:
{ fd: number, fileName: string, fileSize: number }
Write the binary complement of the file.
- fileData:
{ fd: number, fileName: string, fileSize: number }
Rename the file to a random string of length 12.
- fileData:
{ fd: number, fileName: string, fileSize: number }
Truncate to between 25% and 75% of the file size.
- fileData:
{ fd: number, fileName: string, fileSize: number }
Reset file timestamps to 1970-01-01T00:00:00.000Z.
- fileData:
{ fd: number, fileName: string, fileSize: number } - data:
Object- date1:
Date- default:
1970-01-01T00:00:00.000Z. - Date will be greater than or equal date1.
- default:
- date2:
Date- default:
now. - Date will be less than or equal date2.
- default:
- date1:
Randomize file timestamps to a random value between date1 and date2. Setting the same value to date1 and date2 will take away the randomness.