prose_file
Copyright (c) 2020 Seán D. Murray SEE MIT LICENSE FILE
A file Utiliy. Make writing node easier, prettier and less error prone. Writes and reads more like prose
Synopsis
exists(filePath): true if a file exists notExists(filePath): false if a file exists StreamReadLines: Stream a file, line by line. temp: Create a temp file that cleans itself up.
Usage
const file_util = ; /////////////////////// LINE STREAM EXAMPLE ///////////////////// Stream read a file large or small, line by line.const streamReadLines = ;Writable { superoptions } { // Do something here with the lines as they arrive. const line = chunk; console; ; } const testWritable = ;const fileStream = fs;fileStream ; streamReadLines; testWritable;/////////////////////// END /////////////////// // The .xxx is an optional postfix, if not present will be '.tmp'.// An optional prefix can be added too, if not present, no prefix is used.// File is created in the OS default temperary directory.// The file will be deleted if it exists when the program EXITS!file_util;