Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (fs.statSync(absolutePath).size > MAX_FILE_SIZE_BYTES) {
// eslint-disable-next-line no-console
console.warn('\n[percy][WARNING] Skipping large file: ', resourceUrl);
return;
}
// TODO(fotinakis): this is synchronous and potentially memory intensive, but we don't
// keep a reference to the content around so this should be garbage collected. Re-evaluate?
const content = fs.readFileSync(absolutePath);
hashToResource[encodeURI(resourceUrl)] = content;
next();
},
},
};
walk.walkSync(buildDir, walkOptions);
return hashToResource;
}
var exif = require('exif2');
var walk = require('walk');
var elasticsearch = require('elasticsearch');
var readline = require('readline');
var walker = walk.walkSync('/Users/jettrocoenradie/Pictures/export/2013', { followLinks: false });
var client = new elasticsearch.Client({
host: '192.168.1.10:9200',
log:'trace'
});
walker.on('file', function(root, stat, next) {
console.log("Walk " + stat.name);
// Add this file to the list of files
if (strEndsWith(stat.name.toLowerCase(),".jpg")) {
extractData(root + '/' + stat.name, next);
}
next();
});
walker.on('end', function() {
return targets.reduce(function (files, target) {
var stat = fs.statSync(target);
if (stat.isFile()) {
files.push(target);
return files;
}
if (stat.isDirectory()) {
walk.walkSync(target, {
followLinks: false,
filters: ['node_modules', 'bower_components', 'Temp', '_Temp'],
listeners: {
file: function (root, fileStat, next) {
var filePath = path.join(root, fileStat.name);
// filter with suffix (.html)
if (HTML_EXT_PATTERN.test(filePath)) {
files.push(filePath);
}
next();
}
}
});
return files;
}
const options = this.options;
const buildDir = options.buildDir;
const mountPath = `${options.mountPath || ''}/`;
let isDirectory = false;
try {
isDirectory = fs.statSync(buildDir).isDirectory();
} catch (err) {
reject(err);
return;
}
if (isDirectory) {
const resources = [];
let errors;
walk.walkSync(buildDir, {
followLinks: true,
listeners: {
file: function file(root, fileStats, next) {
const absolutePath = path.join(root, fileStats.name);
let resourceUrl = absolutePath;
if (path.sep === '\\') {
// Windows: transform filesystem backslashes into forward-slashes for the URL.
resourceUrl = resourceUrl.replace(/\\/g, '/');
}
resourceUrl = resourceUrl.replace(buildDir, '');
if (resourceUrl.charAt(0) === '/') {
resourceUrl = resourceUrl.substr(1);
}
'before': function() {
walk.walkSync(path.join(__dirname, '../lib'), options);
walk.walkSync(__dirname, options);
},
directories: function(root, dirStatsArray, next) {
next();
},
file: function(root, fileStats, next) {
if (jsOrJsxRegex.test(fileStats.name)) {
files.push(path.join(root, fileStats.name));
}
next();
},
errors: function(root, nodeStatsArray, next) {
console.error('Error with', nodeStatsArray);
next();
}
}
}
walk.walkSync(dirPath, options);
});
}
function addGasBeforeAndAfterHooks() {
const gasHooks = `_$gasTestingHiddenContracts = [${contractsArr}]; before(_$gasTestingHiddenStats.createGasStatCollectorBeforeHook(_$gasTestingHiddenContracts));after(_$gasTestingHiddenStats.createGasStatCollectorAfterHook(_$gasTestingHiddenContracts));`;
let targetFile = fs.readFileSync(path.join(root, fileStats.name))
let improvedFile = targetFile.toString().replace(/\bcontract\s*\(.*?{/g, "$&" + gasHooks);
fs.writeFileSync(path.join(root, fileStats.name), improvedFile);
}
}
next();
}
}
};
walk.walkSync(gasTestDirectory, walkerOptions);
}
};
gulp.task('docs:hbs', ['build:rollup'], function () {
let options = {
listeners: {
file: function (root, stat) {
compileExample(root, stat.name);
}
}
};
walk.walkSync(EXAMPLESSRC, options);
});
appDirs.forEach(function(dirName, index, array) {
if (dirName == 'templates' || dirName == 'config') return;
var dirPath = getAssetPath(dirName);
var walker = walk(dirPath);
walker.on('file', function(dir, stats, next) {
if (stats.name.charAt(0) !== '.') {
var path = unroot(dir+'/'+stats.name).replace(/\.js$/, '');
if (dirName == 'helpers') {
helpers.push({path: path});
} else {
var name = inflector.objectify(path.replace(dirName, ''));
modules.push({
objectName: name,
path: path
});
}
}
next();
});
walker.on('end', function() {
module.exports = function(models_path) {
if (!models_path) {
return;
}
walk.walkSync(models_path, {
listeners: {
file: (basepath, file_data, next) => {
const doctype = path.basename(path.dirname(basepath));
const name = path.basename(basepath);
const file_path = path.resolve(basepath, file_data.name);
if (doctype==='doctype' && file_data.name.endsWith('.js')) {
frappe.modules[file_data.name.slice(0, -3)] = require(file_path);
}
next();
}
}
});
}