Last active
December 26, 2015 21:49
-
-
Save jevets/7219049 to your computer and use it in GitHub Desktop.
Grunt task recurse files async - help needed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* I can't figure out why this doesn't work. | |
* | |
* I've tried using async, but there's no way to know when the exif stuff is done. | |
* | |
* Please help me understand what I'm doing wrong. | |
*/ | |
var util = require('util'); | |
var ExifImage = require('exif').ExifImage; | |
// src/photos contains several photos with exif data | |
grunt.registerTask('default', function() { | |
grunt.file.expand('src/photos/*.jpg').forEach(function(el, i, array) { | |
// this gets output to the console | |
grunt.log.writeln('Attempt to get exif data for ' + el); | |
new ExifImage({ image: 'src/photos/' + el }, function(err, exifData) { | |
// but neither of these do | |
if (err) grunt.log.writeln('Error: ' + err.message); | |
grunt.log.writeln(util.inspect(exifData)); | |
// nor does this | |
grunt.log.writeln('Inside new ExifImage'); | |
}); | |
}); | |
}); |
shama
commented
Oct 29, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment