You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fs_promises.js 345B

12345678910111213
  1. const fs = require("fs");
  2. if (typeof fs.promises === "undefined") {
  3. console.warn("Using an old node version without fs.promises");
  4. const util = require("util");
  5. fs.promises = {};
  6. Object.entries(fs)
  7. .filter(([_, v]) => typeof v === "function")
  8. .forEach(([k, v]) => (fs.promises[k] = util.promisify(v)));
  9. }
  10. module.exports = fs;