From 6c18306c74ecba2f29b1b8ea912aeeddb0cc27d3 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 17 Feb 2022 17:33:28 +0300 Subject: [PATCH] Update file.js --- scripts/core/file.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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