blob: b8fa884984d592b9a8a21d3da1ed1fb022630c51 [file] [log] [blame]
/*
* Copyright (c) 2010-2021 BSI Business Systems Integration AG.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* BSI Business Systems Integration AG - initial API and implementation
*/
const fs = require('fs');
const path = require('path');
const _getAllFiles = dir => {
if (!fs.existsSync(dir)) {
return [];
}
return fs.readdirSync(dir).reduce((files, file) => {
const name = path.join(dir, file);
const isDirectory = fs.statSync(name).isDirectory();
return isDirectory ? [...files, ..._getAllFiles(name)] : [...files, name];
}, []);
};
module.exports = _getAllFiles;