method Deno.FsFile.prototype.truncate
FsFile.prototype.truncate(len?: number): Promise<void>
Truncates (or extends) the file to reach the specified `len`. If `len`
is not specified, then the entire file contents are truncated.
### Truncate the entire file
```ts
using file = await Deno.open("my_file.txt", { write: true });
await file.truncate();
```
### Truncate part of the file
```ts
// if "my_file.txt" contains the text "hello world":
using file = await Deno.open("my_file.txt", { write: true });
await file.truncate(7);
const buf = new Uint8Array(100);
await file.read(buf);
const text = new TextDecoder().decode(buf); // "hello w"
```
Promise<void>