node-7z-threetwo
Version:
A CommonJs and ESM frontend to 7-Zip, downloads binaries in for Linux, Windows, and Mac OSX, with methods to create SFX self extracting 7z archives targeting different platforms.
27 lines (22 loc) • 595 B
JavaScript
;
/**
* Transform a list of files that can be an array or a string into a string
* that can be passed to the `run` function as part of the `command` parameter.
* @param {string|array} files
* @return {string}
*/
module.exports = function (files) {
if (files === undefined) {
return '';
}
let toProcess = '';
if (files instanceof Array) {
files.forEach(function (f) {
toProcess += '"' + f + '" ';
});
toProcess = toProcess.trim();
} else {
toProcess = '"' + files + '"';
}
return toProcess;
};