Skip to content

Instantly share code, notes, and snippets.

@lonfee88
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lonfee88/f8033ea6e639a5ca27d9 to your computer and use it in GitHub Desktop.
Save lonfee88/f8033ea6e639a5ca27d9 to your computer and use it in GitHub Desktop.
node path.sep
var glob = require('glob');
var path = require('path');
var sep = process.platform != 'win32' ? '\\' : '/';
console.log(sep);
var patterns = ['**/*.js', '**\\*.js'];
patterns.map(function(pattern){
var tmp = pattern.split(sep).join(path.sep);
console.log(pattern);
console.log(tmp);
glob(tmp, function (er, files) {
// files is an array of filenames.
// If the `nonull` option is set, and nothing
// was found, then files is ["**/*.js"]
// er is an error object or null.
console.log(files);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment