lib/snippet.js
function (fp, opts, cb) {
    if (typeof fp !== 'string') {
      cb = opts;
      opts = fp;
      fp = null;
    }
    if (typeof opts === 'function') {
      cb = opts;
      opts = {};
    }
    if (typeof cb !== 'function') {
      throw new Error('expected a callback function.');
    }

    var dest = this.dest(fp || this.path, opts);
    var file = { contents: this.content, path: dest };
    opts = extend({ ask: true }, this.options, opts);
    utils.detect(file, opts, function (err) {
      if (file.contents) {
        utils.write(dest, file.contents, cb);
      } else {
        this.copy(dest, cb);
      }
      return this;
    }.bind(this));
    return this;
  }
function (fp, opts, cb) {
    if (typeof fp !== 'string') {
      cb = opts;
      opts = fp;
      fp = null;
    }
    if (typeof opts === 'function') {
      cb = opts;
      opts = {};
    }
    if (typeof cb !== 'function') {
      throw new Error('expected a callback function.');
    }

    var dest = this.dest(fp || this.path, opts);
    var file = { contents: this.content, path: dest };
    opts = extend({ ask: true }, this.options, opts);
    utils.detect(file, opts, function (err) {
      if (file.contents) {
        utils.write(dest, file.contents, cb);
      } else {
        this.copy(dest, cb);
      }
      return this;
    }.bind(this));
    return this;
  }
function ( fp , opts , cb ) { if ( typeof fp !== 'string' ) { cb = opts ; opts = fp ; fp = null ; } if ( typeof opts === 'function' ) { cb = opts ; opts = { } ; } if ( typeof cb !== 'function' ) { throw new Error ( 'expected a callback function.' ) ; } var dest = this . dest ( fp || this . path , opts ) ; var file = { contents : this . content , path : dest } ; opts = extend ( { ask : true } , this . options , opts ) ; utils . detect ( file , opts , function ( err ) { if ( file . contents ) { utils . write ( dest , file . contents , cb ) ; } else { this . copy ( dest , cb ) ; } return this ; } . bind ( this ) ) ; return this ; }
Asynchronously write the snippet to disk.

@name .write
@param {String} `fp` Destination filepath.
@param {Function} `cb` Callback function
@returns {Object} Returns the instance for chaining.
@api public
Asynchronously write the snippet to disk .