Socket
Socket
Sign inDemoInstall

shelljs

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shelljs - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

package.json
{
"name": "shelljs",
"version": "0.2.1",
"version": "0.2.2",
"author": "Artur Adib <aadib@mozilla.com>",

@@ -5,0 +5,0 @@ "description": "Portable Unix shell commands for Node.js",

@@ -511,2 +511,9 @@ # ShellJS - Unix shell commands for Node.js [![Build Status](https://secure.travis-ci.org/arturadib/shelljs.png)](http://travis-ci.org/arturadib/shelljs)

### tempdir()
Examples:
```javascript
var tmp = tempdir(); // "/tmp" for most *nix platforms
```
Searches and returns string containing a writeable, platform-dependent temporary directory.

@@ -513,0 +520,0 @@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).

@@ -39,2 +39,4 @@ var fs = require('fs');

fs.closeSync(fdw);
fs.chmodSync(destFile, fs.statSync(srcFile).mode);
}

@@ -64,17 +66,19 @@

for(var i = 0; i < files.length; i++) {
var currFile = fs.lstatSync(sourceDir + "/" + files[i]);
for (var i = 0; i < files.length; i++) {
var srcFile = sourceDir + "/" + files[i];
var destFile = destDir + "/" + files[i];
var srcFileStat = fs.lstatSync(srcFile);
if (currFile.isDirectory()) {
if (srcFileStat.isDirectory()) {
/* recursion this thing right on back. */
cpdirSyncRecursive(sourceDir + "/" + files[i], destDir + "/" + files[i], opts);
} else if (currFile.isSymbolicLink()) {
var symlinkFull = fs.readlinkSync(sourceDir + "/" + files[i]);
fs.symlinkSync(symlinkFull, destDir + "/" + files[i]);
cpdirSyncRecursive(srcFile, destFile, opts);
} else if (srcFileStat.isSymbolicLink()) {
var symlinkFull = fs.readlinkSync(srcFile);
fs.symlinkSync(symlinkFull, destFile);
} else {
/* At this point, we've hit a file actually worth copying... so copy it on over. */
if (fs.existsSync(destDir + "/" + files[i]) && !opts.force) {
if (fs.existsSync(destFile) && !opts.force) {
common.log('skipping existing file: ' + files[i]);
} else {
copyFileSync(sourceDir + "/" + files[i], destDir + "/" + files[i]);
copyFileSync(srcFile, destFile);
}

@@ -81,0 +85,0 @@ }

@@ -26,2 +26,9 @@ var common = require('./common');

//@ ### tempdir()
//@
//@ Examples:
//@
//@ ```javascript
//@ var tmp = tempdir(); // "/tmp" for most *nix platforms
//@ ```
//@
//@ Searches and returns string containing a writeable, platform-dependent temporary directory.

@@ -28,0 +35,0 @@ //@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc