promisify.js 684 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var stat = exports.stat = function stat(inputFileSystem, path) {
  6. return new Promise(function (resolve, reject) {
  7. inputFileSystem.stat(path, function (err, stats) {
  8. if (err) {
  9. reject(err);
  10. }
  11. resolve(stats);
  12. });
  13. });
  14. };
  15. var readFile = exports.readFile = function readFile(inputFileSystem, path) {
  16. return new Promise(function (resolve, reject) {
  17. inputFileSystem.readFile(path, function (err, stats) {
  18. if (err) {
  19. reject(err);
  20. }
  21. resolve(stats);
  22. });
  23. });
  24. };