unpkg/server/utils/getFileStats.js

16 lines
277 B
JavaScript
Raw Normal View History

2018-02-18 02:00:56 +00:00
const fs = require("fs");
2017-08-18 19:57:42 +00:00
function getFileStats(file) {
return new Promise((resolve, reject) => {
fs.lstat(file, (error, stats) => {
if (error) {
2018-02-18 02:00:56 +00:00
reject(error);
2017-08-18 19:57:42 +00:00
} else {
2018-02-18 02:00:56 +00:00
resolve(stats);
2017-08-18 19:57:42 +00:00
}
2018-02-18 02:00:56 +00:00
});
});
2017-08-18 19:57:42 +00:00
}
2018-02-18 02:00:56 +00:00
module.exports = getFileStats;