budgie-cli
Version:
Node CLI for Budgie.
42 lines • 1.63 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("mz/fs");
/**
* Reads and writes files.
*/
class FileSystem {
/**
* Reads a file.
*
* @param filePath Path to the file.
* @returns Promise for the contents of the file.
*/
readFile(filePath) {
return __awaiter(this, void 0, void 0, function* () {
return (yield fs_1.readFile(filePath)).toString();
});
}
/**
* Writes a file.
*
* @param filePath Path to the file.
* @param contents New contents for the file.
* @returns Promise for writing to the file.
*/
writeFile(filePath, contents) {
return __awaiter(this, void 0, void 0, function* () {
yield fs_1.writeFile(filePath, contents);
});
}
}
exports.FileSystem = FileSystem;
//# sourceMappingURL=fileSystem.js.map