Class

FileUtils

FileUtils()

File I/O utilities for reading and writing CSV/JSON files. Provides both synchronous and asynchronous file operations.

Constructor

# new FileUtils()

View Source src/util/fileUtils.js, line 13

Methods

# readFile(fileInputName, encoding) → {string}

Read a file synchronously with specified encoding.

Parameters:
Name Type Default Description
fileInputName string

Path to file to read

encoding string utf8

File encoding (e.g., 'utf8', 'latin1')

View Source src/util/fileUtils.js, line 94

If file read fails

File contents as string

string

# readFileAsync(fileInputName, encoding) → {Promise.<string>}

Read a file asynchronously with specified encoding. Uses fs.promises when available, falls back to callback-based API.

Parameters:
Name Type Default Description
fileInputName string

Path to file to read

encoding string utf8

File encoding (default: 'utf8')

View Source src/util/fileUtils.js, line 127

If file read fails

Promise resolving to file contents

Promise.<string>

# writeFile(content, fileOutputName)

Write content to a file synchronously.

Parameters:
Name Type Description
content string

Content to write to file

fileOutputName string

Path to output file

View Source src/util/fileUtils.js, line 184

If file write fails

# writeFileAsync(content, fileOutputName) → {Promise.<void>}

Write content to a file asynchronously. Uses fs.promises when available, falls back to callback-based API.

Parameters:
Name Type Description
content string

Content to write to file

fileOutputName string

Path to output file

View Source src/util/fileUtils.js, line 200

If file write fails

Promise that resolves when write completes

Promise.<void>