openFileToUpdate

It opens the file using the "r+" flag. This function is to be used as a dependency/helper for updateFile function. Returns the file descriptor of the open file.
Parameter ListReturnsRejection Errors
  • fileLocationAndName: string
  • tuple: Array (optional)
Promise<number || Array>
Related FunctionsFunction Signature
function openFileToUpdate(fileLocationAndName[, tuple]): Promise<number || Array>
1 2 3 4 import { openFileToUpdate } from "puddy-m/lib/fileFunctions"; openFileToUpdate("./foo.txt") .then(fileDescriptor=>console.log(fileDescriptor)) // Possible outcome: 19
1 2 3 4 5 import { openFileToUpdate } from "puddy-m/lib/fileFunctions"; openFileToUpdate("./foo.txt", []) .then(tuple=>openFileToUpdate("./bar.txt", tuple)) .then(([fd1, fd2])=>console.log("File Descriptor 1: "+ fd1 + " - File Descriptor 2: " + fd2)) // A possible outcome: File Descriptor 1: 19 - File Descriptor 2: 21