Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.aria2 = function(request, filename) {
if (request.method !== "GET" || request.payload)
return null;
let cmd = "aria2c";
for (let i in request.headers) {
cmd += ' --header ' + escapeShellArg(request.headers[i]);
}
if (filename)
cmd += ' --out ' + escapeShellArg(filename);
cmd += ' ' + escapeShellArg(request.uri);
let aria2Options = prefs['aria2.options'];
if (aria2Options)
cmd += ' ' + aria2Options;
return cmd;
};