code: function writeFile(cvs, data, callback) {
      if (typeof data.path !== 'string') {
        return callback(new TypeError('Invalid path type: ' + typeof data.path));
      }
  
      var fd, buff;
  
      // Write the buffer to the open file stream once both prerequisites are met.
      function writeBuffer() {
        fs.write(fd, buff, 0, buff.length, 0, function (error) {
          fs.close(fd);
  
          callback(error);
        });
      }
  
      // Create a buffer of the canvas' data.
      cvs.toBuffer(function (error, _buff) {
        if (error) return callback(error);
  
        buff = _buff;
        if (fd) {
          writeBuffer();
        }
      });
  
      // Open a stream for the file to be written.
      fs.open(data.path, 'w', WRITE_MODE, function (error, _fd) {
        if (error) return callback(error);
  
        fd = _fd;
        if (buff) {
          writeBuffer();
        }
      });
    }
docs: Asynchronously write the data of the rendered canvas to a given file path.