Once all files have been compressed, return compressed JSON file.
@param {Function} callback
14929
function convertToJson(callback) {
    var output = new File(file);
    output.contents = new Buffer(JSON.stringify(spritesheet, null, '\t'));
    output.path = file;
    this.push(output);
    callback();
  }
661451
function ReadFile(path, callback) {
    if (typeof callback === "function") {
        return Fs.readFile(path, ENCODING, callback);
    }
    return Fs.readFileSync(path, ENCODING);
}
142222
function rJson(path, callback) {

    if (typeof callback === "function") {
        Fs.readFile(path, "utf-8", function (err, data) {
            try {
                data = JSON.parse(data);
            } catch (e) {
                err = err || e;
            }
            callback(err, data);
        });
        return;
    }

    return JSON.parse(Fs.readFileSync(path));
}
938546
function (callback) {
            async.map([ "unk.dat.gz", "unk_pos.dat.gz", "unk_map.dat.gz", "unk_char.dat.gz", "unk_compat.dat.gz", "unk_invoke.dat.gz" ], function (filename, _callback) {
                loadArrayBuffer(path.join(dic_path, filename), function (err, buffer) {
                    if(err) {
                        return _callback(err);
                    }
                    _callback(null, buffer);
                });
            }, function (err, buffers) {
                if(err) {
                    return callback(err);
                }
                var unk_buffer = new Uint8Array(buffers[0]);
                var unk_pos_buffer = new Uint8Array(buffers[1]);
                var unk_map_buffer = new Uint8Array(buffers[2]);
                var cat_map_buffer = new Uint8Array(buffers[3]);
                var compat_cat_map_buffer = new Uint32Array(buffers[4]);
                var invoke_def_buffer = new Uint8Array(buffers[5]);

                dic.loadUnknownDictionaries(unk_buffer, unk_pos_buffer, unk_map_buffer, cat_map_buffer, compat_cat_map_buffer, invoke_def_buffer);
                // dic.loadUnknownDictionaries(char_buffer, unk_buffer);
                callback(null);
            });
        }
376861
function compressJS() {
    let tasks = [];

    Object.keys(config.tasks).forEach((key) => {
        let val = config.tasks[key];
        tasks.push(gulp.src(val.src)
            .pipe(plumber({ errorHandler: handleErrors }))
            .pipe(uglify())
            .pipe(rename(config.rename))
            .pipe(gulp.dest(val.dest)));
    });

    return merge(tasks);
}
829786
function(callback) {
			var original = Loader.using;
			Loader.using = this;
			try{
				callback();
			}finally{
				Loader.using = original;
			}
		}
109675
function(callback) {
		var self = this
		this.storage.each(function(val, namespacedKey) {
			callback.call(self, self._deserialize(val), (namespacedKey || '').replace(self._namespaceRegexp, ''))
		})
	}
121974
function(callback) {
          if (!context.copyOriginal) {
            return callback(null);
          }
          var suffix = 'original.' + context.extension;
          var tempFile = context.tempFolder + '/' + suffix;
          if (context.extension !== 'jpg') {
            // Don't forget to tell the caller that we did the work,
            // even if it was just a copy
            context.adjustedOriginal = tempFile;
            return copyFile(context.workingPath, tempFile, callback);
          }

          var args = [ context.workingPath ];
          if (context.crop) {
            args.push('-crop');
            args.push(context.crop.left);
            args.push(context.crop.top);
            args.push(context.crop.width);
            args.push(context.crop.height);
          }
          args.push('-write');
          args.push(tempFile);
          context.adjustedOriginal = tempFile;

          var proc = childProcess.spawn('imagecrunch', args);
          proc.on('close', function(code) {
            if (code !== 0) {
              return callback(code);
            }
            return callback(null);
          });
        }
765223
function(callback) {
      fs.readdir(args['<directory>'], function(err, files) {
        // error here means it does not exist, which is good.
        if (err || args['--force']) {
          return callback(null, args['<directory>']);
        }
        if (files.length > 0) {
          return callback(new Error(format('destination '
            + 'directory %s is not empty.', path.resolve(args['<directory>']))));
        }
        return callback(null, args['<directory>']);
      });
    }
471602
function _getSavedBytes(rawFile, compressedFile) {
    var savedBytes = rawFile.size - compressedFile.size;

    if (savedBytes > 0) return savedBytes;

    return 0;
}
842686
function(files, callback) {
      var recursiveCp = files.map(function(file) {
        return function(callback) {
          _cp({ source: path.join(directory, file), destination: options.destination }, callback);
        };
      });
      async.series(recursiveCp, callback);
    }
1305093
function writeFile(callback) {
        var s = JSON.stringify(images);

        fs.writeFile('imageData.json', s, function (err) {
          if (err) return console.log(err);
          else
            { 
            console.log("success");
            if (callback) callback.call(this, images);
            }
        });


    }
189762
function(callback) {

			var fileLoop = function(currentDir,templateDirectories,cb) {
				var callback_has_been_called = false
				fs.readdir(currentDir,function(err,files) {
					if (err) {
						return console.log('Unable to find files in path',currentDir)
					}
					var num = files.length

					var finishFile = function(i) {
						if (!(--num)) {
							if (!callback_has_been_called) {
								callback_has_been_called = true
								return cb()
							}
						} else {
							buildFileData(i+1)
						}
					}

					var buildFileData = function(i) {
						var file = files[i]
						var filepath = currentDir + '/' + file

						fs.stat(filepath,function(err2,stats) {
							if (err2) {
								return console.log('Unable to find file',filepath)
							}

							if (stats && stats.isDirectory()) {
								var pugatizerPath = '    puglatizer' + currentDir.replace(templateDirectories,'').replace(/\//g,'"]["') + '"]["' + file.replace('.pug','') + '"] = {}\r\n'
								pugatizerPath = pugatizerPath.replace('puglatizer"]','puglatizer')
								fs.appendFileSync(outputFile,pugatizerPath)
								fileLoop(filepath,templateDirectories,function() {
									finishFile(i)
								})
							} else if (stats && stats.isFile()) {
								var ext = path.extname(filepath)
								if (ext == '.pug') {
									var pugatizerPath = '    puglatizer' + currentDir.replace(templateDirectories,'').replace(/\//g,'"]["') + '"]["' + file.replace('.pug','') + '"] = '
									pugatizerPath = pugatizerPath.replace('puglatizer"]','puglatizer')
									buildTemplateFromFile(filepath,options,function(err,template) {
										pugatizerPath += minify.js(template.toString()) + ';\r\n\r\n'
										fs.appendFileSync(outputFile,pugatizerPath)
										finishFile(i)
									})
								} else {
									finishFile(i)
								}
							} else {
								finishFile(i)
							}
						})
					}

					if (!num) {
						return console.log('Unable to find files in path',currentDir)
					} else {
						buildFileData(0)
					}

				})

			}
			
			fileLoop(templateDirectories,templateDirectories,function() {
				return callback()
			})
		}
431917
function writeFiles (files, callback) {
  async.map(files, writeFile.bind(this), function (err) {
    if (err) callback(err);
    callback(null);
  });
}
1081903
function(callback) {
    //process first all directories and then all files.
    async.mapSeries(['getDirectories', 'getFiles'], (nodeSource, cbMap) => {
      syncDb[nodeSource]((err, nodes) => {
        async.eachSeries(nodes, (node, cb) => {
          if(node.localActions && node.localActions.create) {
            var nodePath = utility.joinPath(node.parent, node.name);

            syncDb.findByPath(nodePath, (err, syncedNode) => {
              try {
                var stat = fsWrap.lstatSync(nodePath);
              } catch(e) {
                logger.warning('resolveConflicts got lstat error on node', {category: 'sync-local-delta', nodePath, code: e.code});
                throw new BlnDeltaError(e.message);
              }

              //deleted and recreated at same path
              if(syncedNode.localActions && syncedNode.localActions.delete) {
                syncedNode.ino = stat.ino;

                delete syncedNode.localActions.delete;

                if(syncedNode.directory) {
                  syncedNode.ctime = stat.ctime;
                  syncedNode.mtime = stat.mtime;
                  syncedNode.size = stat.size;
                } else {
                  syncedNode.localActions.create = node.localActions.create;
                }

                async.parallel([
                  (cbParallel) => {
                    syncDb.update(syncedNode._id, syncedNode, cbParallel);
                  },
                  (cbParallel) => {
                    syncDb.remove(node._id, cbParallel);
                  }
                ], cb);
              } else {
                cb(null);
              }
            });
          } else {
            cb(null);
          }
        }, cbMap);
      });
    }, callback);
  }
403094
function(callback) {
            spidex.put(self.baseUri + "/" + uploadFilename, {
                data: rawData,
                header: header,
                charset: "utf8"
            }, function(html, status, respHeader) {
                if(200 !== status && 201 !== status) {
                    return callback(new Error(html.replace("</h1>", "</h1> ").stripTags()));
                }

                var result = {};
                if(respHeader["x-upyun-width"] !== undefined) result.width = parseInt(respHeader["x-upyun-width"]);
                if(respHeader["x-upyun-height"] !== undefined) result.height = parseInt(respHeader["x-upyun-height"]);
                if(respHeader["x-upyun-frames"] !== undefined) result.frames = parseInt(respHeader["x-upyun-frames"]);
                if(respHeader["x-upyun-file-type"] !== undefined) result.type = respHeader["x-upyun-file-type"];

                callback(undefined, result);
            }).on("error", callback);
        }
335531
function (callback) {
	return function (res) {
		var resData = "";
		res.setEncoding('utf8');
		res.on('data',function(chunk) { resData+=chunk; });
		res.on('end', function() { callback(res,resData); });
	};
}