diff --git a/scripts/core/file.js b/scripts/core/file.js index ecb4a040..440b3928 100644 --- a/scripts/core/file.js +++ b/scripts/core/file.js @@ -1,6 +1,7 @@ const path = require('path') const glob = require('glob') const fs = require('mz/fs') +const crlf = require('crlf') const file = {} @@ -65,4 +66,13 @@ file.basename = function (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