Socket
Socket
Sign inDemoInstall

prostore.glob-utils

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prostore.glob-utils - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

47

index.js
'use strict';
var glob = require('glob');
var glob = require('glob')
, async = require('async')
, fs = require('fs')
, path = require('path')
, crypto = require('crypto');
module.exports = exports = function(cwd, pattern, cb) {
var files = [];
var g = new glob.Glob(pattern, {
cwd: cwd,
nodir: true,
stat: true
glob(pattern, { cwd: cwd, nodir: true }, function(err, files) {
/* istanbul ignore if */
if (err) return cb(err);
async.map(files, function(file, cb) {
var filename = path.resolve(cwd, file);
fs.stat(filename, function(err, stat) {
/* istanbul ignore if */
if (err) return cb(err);
var hash = crypto.createHash('md5')
, stream = fs.createReadStream(filename, 'utf-8');
stream.on('data', function(data) {
hash.update(data);
});
stream.on('error', function(err) {
cb(err);
});
stream.on('end', function() {
cb(null, {
path: file,
md5: hash.digest('hex'),
mtime: stat.mtime.getTime()
});
});
});
}, cb);
});
g.on('stat', function(file, stat) {
files.push({
path: file,
mtime: stat.mtime.getTime()
});
});
g.on('end', function() {
cb(null, files);
});
};

@@ -36,3 +51,3 @@

}
if (srcFile.mtime < dstFile.mtime)
if (srcFile.md5 && srcFile.md5 == dstFile.md5)
unmodified.push(dstFile);

@@ -39,0 +54,0 @@ else

{
"name": "prostore.glob-utils",
"version": "0.0.1",
"version": "0.0.2",
"description": "Glob Utilities",
"main": "index.js",
"dependencies": {
"glob": "*"
"glob": "*",
"async": "*"
},

@@ -9,0 +10,0 @@ "repository": {

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