2020-07-15 01:24:47 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
async function getFileEntries(location) {
|
|
|
|
if (!location) {
|
|
|
|
throw new Error('No filepath provided');
|
|
|
|
}
|
|
|
|
|
|
|
|
const file = await fs.promises.readFile(location, 'utf-8');
|
2021-11-20 22:59:15 +00:00
|
|
|
const entries = file.split(/\n/).map((entry) => entry.trim()).filter(Boolean);
|
2020-07-15 01:24:47 +00:00
|
|
|
|
|
|
|
return entries;
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = getFileEntries;
|