"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

function _bluebird() {
  const data = require("bluebird");

  _bluebird = function () {
    return data;
  };

  return data;
}

function _os() {
  const data = require("os");

  _os = function () {
    return data;
  };

  return data;
}

function _fsExtra() {
  const data = _interopRequireDefault(require("fs-extra"));

  _fsExtra = function () {
    return data;
  };

  return data;
}

var _default =
/*#__PURE__*/
function () {
  var _writeFile = (0, _bluebird().coroutine)(function* (path, contents, options = {}) {
    yield _fsExtra().default.outputFile(path, contents);

    if (options.gid || options.uid) {
      const user = (0, _os().userInfo)();
      yield _fsExtra().default.chown(path, options.uid || user.uid, options.gid || user.gid);
    }
  });

  function writeFile(_x, _x2) {
    return _writeFile.apply(this, arguments);
  }

  return writeFile;
}();

exports.default = _default;