Innovenergy_trunk/frontend/node_modules/testcafe-hammerhead/lib/utils/promisified-functions.js

27 lines
1.7 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.exec = exports.fsObjectExists = exports.writeFile = exports.makeDir = exports.access = exports.stat = exports.readFile = exports.readDir = exports.brotliDecompress = exports.brotliCompress = exports.inflateRaw = exports.inflate = exports.gunzip = exports.deflate = exports.gzip = void 0;
const zlib_1 = __importDefault(require("zlib"));
const util_1 = require("util");
const fs_1 = __importDefault(require("fs"));
const child_process_1 = __importDefault(require("child_process"));
exports.gzip = (0, util_1.promisify)(zlib_1.default.gzip);
exports.deflate = (0, util_1.promisify)(zlib_1.default.deflate);
exports.gunzip = (0, util_1.promisify)(zlib_1.default.gunzip);
exports.inflate = (0, util_1.promisify)(zlib_1.default.inflate);
exports.inflateRaw = (0, util_1.promisify)(zlib_1.default.inflateRaw);
exports.brotliCompress = (0, util_1.promisify)(zlib_1.default.brotliCompress);
exports.brotliDecompress = (0, util_1.promisify)(zlib_1.default.brotliDecompress);
exports.readDir = (0, util_1.promisify)(fs_1.default.readdir);
exports.readFile = (0, util_1.promisify)(fs_1.default.readFile);
exports.stat = (0, util_1.promisify)(fs_1.default.stat);
exports.access = (0, util_1.promisify)(fs_1.default.access);
exports.makeDir = (0, util_1.promisify)(fs_1.default.mkdir);
exports.writeFile = (0, util_1.promisify)(fs_1.default.writeFile);
const fsObjectExists = (fsPath) => (0, exports.stat)(fsPath).then(() => true, () => false);
exports.fsObjectExists = fsObjectExists;
exports.exec = (0, util_1.promisify)(child_process_1.default.exec);