UNPKG

sortier

Version:
25 lines (24 loc) 672 B
import * as fs from "fs"; import { join } from "path"; export class FileUtils { static globbyJoin(...paths) { const path = join(...paths); return path.split("\\").join("/"); } static readFileContents(filename) { try { return fs.readFileSync(filename, "utf8"); } catch (error) { throw new Error(`Could not read file: ${filename}`); } } static writeFileContents(filename, fileContents) { try { fs.writeFileSync(filename, fileContents, "utf8"); } catch (error) { throw new Error(`Could not write file: ${filename}`); } } }