mirror of
https://github.com/lovasoa/whitebophir
synced 2024-11-14 00:07:07 +00:00
13 lines
345 B
JavaScript
13 lines
345 B
JavaScript
const fs = require("fs");
|
|
|
|
if (typeof fs.promises === "undefined") {
|
|
console.warn("Using an old node version without fs.promises");
|
|
|
|
const util = require("util");
|
|
fs.promises = {};
|
|
Object.entries(fs)
|
|
.filter(([_, v]) => typeof v === "function")
|
|
.forEach(([k, v]) => (fs.promises[k] = util.promisify(v)));
|
|
}
|
|
|
|
module.exports = fs;
|