truncateFile

Takes a file descriptor and truncates the file. Resolves the same fileDescriptor if the truncating executed successfully.
Parameter ListReturnsRejection Errors
  • fileDescriptor: number
  • tuple: Array (optional)
Promise<number || Array>
Related FunctionsFunction Signature
function truncateFile(supposedString[, tuple]): Promise<number || Array>
1 2 3 4 5 import { truncateFile, openFile } from "puddy-m/lib/fileFunctions"; openFile("./foo.txt", "w") .then(truncateFile) .then(console.log); // Possible outcome: 17
1 2 3 4 5 6 7 8 9 import { truncateFile, openFile } from "puddy-m/lib/fileFunctions"; const f = async () => { const fileDescriptor = await openFile("./foo.txt", "w").then(truncateFile); console.log(fileDescriptor); // Possible outcome: 17 }; f();