import fs from 'fs';
import { doesFileExist } from '../utils/file-utils.js';
export function readFiles(iterable) {
    if (!iterable) {
        throw new Error('The passed files must not be nil.');
    }
    return iterable.map(path => readFile(path));
}
export function readFile(path) {
    if (!path) {
        throw new Error('The passed file must not be nil to be read.');
    }
    if (!doesFileExist(path)) {
        throw new Error(`The passed file '${path}' must exist and must not be a directory to be read.`);
    }
    return fs.readFileSync(path, 'utf-8').toString();
}
