code: function replyHandler(err, result) {
  
      var message;
  
      if (err) {
  
          if (err.code) {
  
              // Could not read the local file
              if (err.code === "ENOENT") {
                  message = ["-", chalk.red("✘"), chalk.grey(err.path), chalk.red("File not found")];
  
              // Other HTTP errors
              } else {
                  message = ["-", chalk.red("✘"), chalk.grey(err.path), err.code, chalk.red(err.message)];
              }
  
  
          } else {
  
              // Errors without attached codes
              message = ["-", chalk.red("✘ There was an error"), JSON.stringify(err)];
          }
  
          console.error(message.join(" "));
          return;
      }
  
      // How did we do?
      result.input.size = filesize(result.input.size);
      result.output.size = filesize(result.output.size);
  
      // If the ratio is >= 1, then the file was not reduced and so there is no point in overwriting it
      if (result.output.ratio >= 1) {
          message = ["-", chalk.green("✓"), chalk.grey(result.input.name), result.input.size, "(Already optimized)"];
          console.log(message.join(" "));
          return;
      }
  
      // So the filesize was reduced. Conver the reduction to a percentage and then save the file
      result.output.reduction = (100 - Math.round(result.output.ratio * 100)) + "%";
      fs.writeFile(result.input.name, result.output.image, {"encoding": "binary"}, function (err) {
  
          if (err) {
              message = ["-", chalk.red("✘"), chalk.grey(result.input.name), "Error saving file"];
              console.error(message.join(" "));
              return;
          }
  
          // Log what we have done
          message = [result.output.size, "(was", result.input.size + ",", result.output.reduction, "reduction)"];
          message = ["+", chalk.green("✓"), chalk.grey(result.input.name), message.join(" ")];
          console.log(message.join(" "));
      });
  }
docs: Handle the response form TinyPNG