UNPKG

@boostercloud/cli

Version:

CLI of the Booster Framework, the next level of abstraction for cloud-native applications

10 lines (9 loc) 824 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LiveFileSystem = void 0; const effect_1 = require("@boostercloud/framework-types/dist/effect"); const _1 = require("."); const fs = require("fs"); const readDirectoryContents = (directoryPath) => (0, effect_1.tryCatchPromise)(() => fs.promises.readdir(directoryPath), (reason) => new _1.FileSystemError(new Error(`There were some issues reading the directory ${directoryPath}: ${reason}`))); const readFileContents = (filePath) => (0, effect_1.tryCatchPromise)(() => fs.promises.readFile(filePath, 'utf8'), (reason) => new _1.FileSystemError(new Error(`There were some issues reading the file ${filePath}: ${reason}`))); exports.LiveFileSystem = effect_1.Layer.fromValue(_1.FileSystemService)({ readDirectoryContents, readFileContents });