Skip to content
Create a gist now

Instantly share code, notes, and snippets.

var sys = require("sys"),
fs = require("fs");
function processImageDir(path, outFilename, cb) {
fs.readdir(path, function(err, files) {
fs.writeFile(__dirname + '/' + outFilename, JSON.stringify({
images: files.filter(function(name) { return /(?:png|jpe?g|gif)$/i.test(name); })
}), function(err) {
if (err) throw err;
cb && cb("Sweet.");
processImageDir('/path/to/your/images/dir', "preload-images.json", function(message) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.