Socket
Socket
Sign inDemoInstall

sander

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sander - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

84

index.js

@@ -449,3 +449,83 @@ var path = require( 'path' ),

sander.lsr = function () {
var basedir = resolve( arguments );
return new Promise( function ( fulfil, reject ) {
var result = [];
processdir( basedir, function ( err ) {
if ( err ) {
reject( err );
} else {
fulfil( result );
}
});
function processdir ( dir, cb ) {
fs.readdir( dir, function ( err, files ) {
var remaining, check;
if ( err ) {
cb( err );
} else {
remaining = files.length;
if ( !remaining ) {
return cb();
}
files = files.map( function ( file ) {
return dir + path.sep + file;
});
check = function ( err ) {
if ( err ) {
cb( err );
}
else if ( !--remaining ) {
cb();
}
};
files.forEach( function ( file ) {
fs.stat( file, function ( err, stats ) {
if ( err ) {
cb( err );
} else {
if ( stats.isDirectory() ) {
processdir( file, check );
} else {
result.push( file.replace( basedir + path.sep, '' ) );
check();
}
}
});
});
}
});
}
});
};
sander.lsrSync = function () {
var basedir = resolve( arguments ), result = [];
processdir( basedir );
return result;
function processdir ( dir ) {
fs.readdirSync( dir ).forEach( function ( file ) {
var filepath = dir + path.sep + file;
if ( fs.statSync( filepath ).isDirectory() ) {
processdir( filepath );
} else {
result.push( filepath.replace( basedir + path.sep, '' ) );
}
});
}
};
sander.Promise = Promise;

@@ -455,7 +535,3 @@

function resolve ( pathargs ) {
if ( pathargs.length === 1 ) {
return pathargs[0];
}
return path.resolve.apply( null, pathargs );
}

2

package.json

@@ -5,3 +5,3 @@ {

"author": "Rich Harris",
"version": "0.1.0",
"version": "0.1.1",
"dependencies": {

@@ -8,0 +8,0 @@ "es6-promise": "^1.0.0",

@@ -162,7 +162,11 @@ # sander

// while `writeOptions` is passed to `fs.createWriteStream`
sander.copyFile(...paths, [readOptions]).to(...paths, [writeOptions]);
sander.copyFile(...paths, [readOptions]).to(...paths, [writeOptions])
// Copy a file synchronously. `readOptions`, is passed to `fs.readFileSync`,
// while `writeOptions` is passed to `fs.writeFileSync`
sander.copyFileSync(...paths, [readOptions]).to(...paths, [writeOptions]);
sander.copyFileSync(...paths, [readOptions]).to(...paths, [writeOptions])
// List contents of a folder, recursively
sander.lsr(...paths)
sander.lsrSync(...paths)
```

@@ -169,0 +173,0 @@

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