attachment(filename) {
    // Check for supplied filename/path
    let name = typeof filename === 'string' && filename.trim().length > 0 ? path.parse(filename) : undefined
    this.header('Content-Disposition', 'attachment' + (name ? '; filename="' + name.base + '"' : ''))

    // If name exits, attempt to set the type
    if (name) { this.type(name.ext) }
    return this
  }
// Set content-disposition header and content type
Set content-disposition header and content type
Set content - disposition header and content type
attachment(filename) {
    let name = typeof filename === 'string' && filename.trim().length > 0 ? path.parse(filename) : undefined
    this.header('Content-Disposition', 'attachment' + (name ? '; filename="' + name.base + '"' : ''))
    if (name) { this.type(name.ext) }
    return this
  }
attachment ( filename ) { let name = typeof filename === 'string' && filename . trim ( ) . length > 0 ? path . parse ( filename ) : undefined this . header ( 'Content-Disposition' , 'attachment' + ( name ? '; filename="' + name . base + '"' : '' ) ) if ( name ) { this . type ( name . ext ) } return this }
Set content-disposition header and content type
Set content - disposition header and content type
// Check for supplied filename/path // If name exits, attempt to set the type