Update file.js

This commit is contained in:
Aleksandr Statciuk 2022-02-17 17:33:28 +03:00
parent af21b368bd
commit 6c18306c74

View file

@ -1,6 +1,7 @@
const path = require('path') const path = require('path')
const glob = require('glob') const glob = require('glob')
const fs = require('mz/fs') const fs = require('mz/fs')
const crlf = require('crlf')
const file = {} const file = {}
@ -65,4 +66,13 @@ file.basename = function (filepath) {
return path.basename(filepath) return path.basename(filepath)
} }
file.eol = function (filepath) {
return new Promise((resolve, reject) => {
crlf.get(filepath, null, function (err, endingType) {
if (err) reject(err)
resolve(endingType)
})
})
}
module.exports = file module.exports = file