New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

copy-and-watch

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy-and-watch - npm Package Compare versions

Comparing version

to
0.1.0

18

index.js

@@ -39,10 +39,20 @@ /* IMPORTS */

};
const createDirIfNotExist = dir => {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
const createDirIfNotExist = to => {
const dirs = [];
let dir = path.dirname(to);
while (dir !== path.dirname(dir)) {
dirs.unshift(dir);
dir = path.dirname(dir);
}
dirs.forEach(dir => {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
});
};
const copy = from => {
const to = findTarget(from);
createDirIfNotExist(path.dirname(to));
createDirIfNotExist(to);
fs.writeFileSync(to, fs.readFileSync(from));

@@ -49,0 +59,0 @@ console.log('[COPY]'.yellow, from, 'to'.yellow, to);

{
"name": "copy-and-watch",
"version": "0.0.8",
"version": "0.1.0",
"description": "Synchronize files or folders locally, with a watch option",

@@ -5,0 +5,0 @@ "main": "index.js",