code: function(data, path, callback) {
        data = normalizeData(data);
  
        switch (typeof path) {
          case 'function':
            callback = path;
            path = null;
            break;
          case 'string':
            data.path = path;
            break;
        }
  
        // Callback function is required.
        if (typeof callback !== 'function') {
          throw new TypeError('Invalid callback type: ' + typeof callback);
        }
  
        var completed = false;
        // `<canvas>` element only which the QR code is rendered.
        var cvs = this.canvas(data);
  
        // Simple function to try and ensure that the `callback` function is only called once.
        function done(error) {
          if (!completed) {
            completed = true;
  
            callback(error);
          }
        }
  
        if (inNode) {
          writeFile(cvs, data, done);
        } else {
          download(cvs, data, done);
        }
      }
docs: Generate the QR code using the data provided and render it on to a `<canvas>` element and save it as an image file. If no `<canvas>` element is specified in the argument provided a new one will be created and used. ECC (error correction capacity) determines how many intential errors are contained in the QR code. If called in a browser the `path` property/argument is ignored and will simply prompt the user to choose a location and file name. However, if called within node.js the file will be saved to specified path. A `callback` function must be provided which will be called once the saving process has started. If an error occurs it will be passed as the first argument to this function, otherwise this argument will be `null`.