🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

fs-path

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-path - npm Package Compare versions

Comparing version

to
0.0.25

@@ -6,2 +6,3 @@ "use strict";

var child_process = require('child_process');
const shellescape = require('shell-escape')

@@ -59,7 +60,8 @@ var fsPath = {

if (that._win32) {
cmd = 'echo d|xcopy /s /e /y "' + path.join(from, '*') + '" "' + dist + '"';
cmd = 'echo d|xcopy /s /e /y ' + shellescape([path.join(from, '*')]) + ' ' + shellescape([dist]);
} else {
cmd = 'cp -f -R -p ' + path.join(from, '*').replace(/ /g, '\\ ') + ' ' + dist.replace(/ /g, '\\ ');
cmd = 'cp -f -R -p ' + shellescape([path.join(from, '*')]) + ' ' + shellescape([dist]);
}
child_process.exec(cmd, function (error, stdout, stderr) {
var command = cmd.split(' ');
child_process.execFile(command[0], command.slice(1), function (error, stdout, stderr) {
callback && callback(error);

@@ -71,7 +73,8 @@ });

if (that._win32) {
cmd = 'echo f|xcopy /y "' + from + '" "' + dist + '"';
cmd = 'echo f|xcopy /y ' + shellescape([from]) + ' ' + shellescape([dist]);
} else {
cmd = 'cp -f -p ' + from.replace(/ /g, '\\ ') + ' ' + dist.replace(/ /g, '\\ ');
cmd = 'cp -f -p ' + shellescape([from]) + ' ' + shellescape([dist]);
}
child_process.exec(cmd, function (error, stdout, stderr) {
var command = cmd.split(' ');
child_process.execFile(command[0], command.slice(1), function (error, stdout, stderr) {
callback && callback(error);

@@ -94,6 +97,6 @@ });

// windows
cmd = 'echo da|xcopy /s /e "' + path.join(from, '*') + '" "' + dist + '"';
cmd = 'echo da|xcopy /s /e ' + shellescape([path.join(from, '*')]) + ' ' + shellescape([dist]);
} else {
// linux or mac
cmd = 'cp -f -R -p ' + path.join(from, '*').replace(/ /g, '\\ ') + ' ' + dist.replace(/ /g, '\\ ');
cmd = 'cp -f -R -p ' + shellescape([path.join(from, '*')]) + ' ' + shellescape([dist]);
}

@@ -103,9 +106,10 @@ } else if (stats.isFile()) {

// windows
cmd = 'echo fa|xcopy "' + from + '" "' + dist + '"';
cmd = 'echo fa|xcopy ' + shellescape([from]) + ' ' + shellescape([dist]);
} else {
// linux or mac
cmd = 'cp -f -p ' + from.replace(/ /g, '\\ ') + ' ' + dist.replace(/ /g, '\\ ');
cmd = 'cp -f -p ' + shellescape([from]) + ' ' + shellescape([dist]);
}
}
cmd && child_process.execSync(cmd);
var command = cmd.split(' ')
cmd && child_process.execFileSync(command[0], command.slice(1));
} catch (e) {}

@@ -123,12 +127,13 @@ },

if (stats.isDirectory()) {
cmd = 'rd /s /q "' + from + '"';
cmd = 'rd /s /q ' + shellescape([from]);
} else if (stats.isFile()) {
cmd = 'del /f "' + from + '"';
cmd = 'del /f ' + shellescape([from]);
}
} else {
// linux or mac
cmd = 'rm -rf ' + from.replace(/ /g, '\\ ');
cmd = 'rm -rf ' + shellescape([from]);
}
if (cmd) {
child_process.exec(cmd, function (error, stdout, stderr) {
var command = cmd.split(' ')
child_process.execFile(command[0], command.slice(1), function (error, stdout, stderr) {
callback && callback(error);

@@ -150,11 +155,12 @@ });

if (stats.isDirectory()) {
cmd = 'rd /s /q "' + from + '"';
cmd = 'rd /s /q ' + shellescape([from]);
} else if (stats.isFile()) {
cmd = 'del /f "' + from + '"';
cmd = 'del /f ' + shellescape([from]);
}
} else {
// linux or mac
cmd = 'rm -rf "' + from + '"';
cmd = 'rm -rf ' + shellescape([from]);
}
cmd && child_process.execSync(cmd);
var command = cmd.split(' ');
cmd && child_process.execFileSync(command[0], command.slice(1));
} catch (e) {}

@@ -271,2 +277,2 @@ },

};
module.exports = fsPath;
module.exports = fsPath;
{
"name": "fs-path",
"version": "0.0.24",
"version": "0.0.25",
"main": "lib/index.js",

@@ -24,3 +24,4 @@ "author": {

"dependencies": {
"async": "~0.9.0"
"async": "~0.9.0",
"shell-escape": "^0.2.0"
},

@@ -30,2 +31,2 @@ "description": "file and directory op libs, find, findSync, mkdir, mkdirSync, copy, copySync, remove, removeSync, writeFile, writeFileSync",

"license": "MIT"
}
}