index.js
function SendStream (req, path, options) {
  Stream.call(this)

  var opts = options || {}

  this.options = opts
  this.path = path
  this.req = req

  this._acceptRanges = opts.acceptRanges !== undefined
    ? Boolean(opts.acceptRanges)
    : true

  this._cacheControl = opts.cacheControl !== undefined
    ? Boolean(opts.cacheControl)
    : true

  this._etag = opts.etag !== undefined
    ? Boolean(opts.etag)
    : true

  this._dotfiles = opts.dotfiles !== undefined
    ? opts.dotfiles
    : 'ignore'

  if (this._dotfiles !== 'ignore' && this._dotfiles !== 'allow' && this._dotfiles !== 'deny') {
    throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"')
  }

  this._hidden = Boolean(opts.hidden)

  if (opts.hidden !== undefined) {
    deprecate('hidden: use dotfiles: \'' + (this._hidden ? 'allow' : 'ignore') + '\' instead')
  }

  // legacy support
  if (opts.dotfiles === undefined) {
    this._dotfiles = undefined
  }

  this._extensions = opts.extensions !== undefined
    ? normalizeList(opts.extensions, 'extensions option')
    : []

  this._immutable = opts.immutable !== undefined
    ? Boolean(opts.immutable)
    : false

  this._index = opts.index !== undefined
    ? normalizeList(opts.index, 'index option')
    : ['index.html']

  this._lastModified = opts.lastModified !== undefined
    ? Boolean(opts.lastModified)
    : true

  this._maxage = opts.maxAge || opts.maxage
  this._maxage = typeof this._maxage === 'string'
    ? ms(this._maxage)
    : Number(this._maxage)
  this._maxage = !isNaN(this._maxage)
    ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE)
    : 0

  this._root = opts.root
    ? resolve(opts.root)
    : null

  if (!this._root && opts.from) {
    this.from(opts.from)
  }
}
function SendStream (req, path, options) {
  Stream.call(this)

  var opts = options || {}

  this.options = opts
  this.path = path
  this.req = req

  this._acceptRanges = opts.acceptRanges !== undefined
    ? Boolean(opts.acceptRanges)
    : true

  this._cacheControl = opts.cacheControl !== undefined
    ? Boolean(opts.cacheControl)
    : true

  this._etag = opts.etag !== undefined
    ? Boolean(opts.etag)
    : true

  this._dotfiles = opts.dotfiles !== undefined
    ? opts.dotfiles
    : 'ignore'

  if (this._dotfiles !== 'ignore' && this._dotfiles !== 'allow' && this._dotfiles !== 'deny') {
    throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"')
  }

  this._hidden = Boolean(opts.hidden)

  if (opts.hidden !== undefined) {
    deprecate('hidden: use dotfiles: \'' + (this._hidden ? 'allow' : 'ignore') + '\' instead')
  }

  // legacy support
  if (opts.dotfiles === undefined) {
    this._dotfiles = undefined
  }

  this._extensions = opts.extensions !== undefined
    ? normalizeList(opts.extensions, 'extensions option')
    : []

  this._immutable = opts.immutable !== undefined
    ? Boolean(opts.immutable)
    : false

  this._index = opts.index !== undefined
    ? normalizeList(opts.index, 'index option')
    : ['index.html']

  this._lastModified = opts.lastModified !== undefined
    ? Boolean(opts.lastModified)
    : true

  this._maxage = opts.maxAge || opts.maxage
  this._maxage = typeof this._maxage === 'string'
    ? ms(this._maxage)
    : Number(this._maxage)
  this._maxage = !isNaN(this._maxage)
    ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE)
    : 0

  this._root = opts.root
    ? resolve(opts.root)
    : null

  if (!this._root && opts.from) {
    this.from(opts.from)
  }
}
function SendStream ( req , path , options ) { Stream . call ( this ) var opts = options || { } this . options = opts this . path = path this . req = req this . _acceptRanges = opts . acceptRanges !== undefined ? Boolean ( opts . acceptRanges ) : true this . _cacheControl = opts . cacheControl !== undefined ? Boolean ( opts . cacheControl ) : true this . _etag = opts . etag !== undefined ? Boolean ( opts . etag ) : true this . _dotfiles = opts . dotfiles !== undefined ? opts . dotfiles : 'ignore' if ( this . _dotfiles !== 'ignore' && this . _dotfiles !== 'allow' && this . _dotfiles !== 'deny' ) { throw new TypeError ( 'dotfiles option must be "allow", "deny", or "ignore"' ) } this . _hidden = Boolean ( opts . hidden ) if ( opts . hidden !== undefined ) { deprecate ( 'hidden: use dotfiles: \'' + ( this . _hidden ? 'allow' : 'ignore' ) + '\' instead' ) } // legacy support if ( opts . dotfiles === undefined ) { this . _dotfiles = undefined } this . _extensions = opts . extensions !== undefined ? normalizeList ( opts . extensions , 'extensions option' ) : [ ] this . _immutable = opts . immutable !== undefined ? Boolean ( opts . immutable ) : false this . _index = opts . index !== undefined ? normalizeList ( opts . index , 'index option' ) : [ 'index.html' ] this . _lastModified = opts . lastModified !== undefined ? Boolean ( opts . lastModified ) : true this . _maxage = opts . maxAge || opts . maxage this . _maxage = typeof this . _maxage === 'string' ? ms ( this . _maxage ) : Number ( this . _maxage ) this . _maxage = ! isNaN ( this . _maxage ) ? Math . min ( Math . max ( 0 , this . _maxage ) , MAX_MAXAGE ) : 0 this . _root = opts . root ? resolve ( opts . root ) : null if ( ! this . _root && opts . from ) { this . from ( opts . from ) } }
Initialize a `SendStream` with the given `path`.

@param {Request} req
@param {String} path
@param {object} [options]
@private
Initialize a SendStream with the given path .