< Back

Set-PodeResponseAttachment

Sat Jan 18, 2020 7:19 pm

NAME Set-PodeResponseAttachment



SYNOPSIS

Attaches a file onto the Response for downloading.





SYNTAX

Set-PodeResponseAttachment [-Path] <String> [[-ContentType] <String>] [<CommonParameters>]





DESCRIPTION

Attaches a file from the "/public", and static Routes, onto the Response for downloading.

If the supplied path is not in the Static Routes but is a literal/relative path, then this file is used instead.





PARAMETERS

-Path <String>

The Path to a static file relative to the "/public" directory, or a static Route.

If the supplied Path doesn't match any custom static Route, then Pode will look in the "/public" directory.

Failing this, if the file path exists as a literal/relative file, then this file is used as a fall back.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ContentType <String>

Manually specify the content type of the response rather than infering it from the attachment's file extension.

The supplied value must match the valid ContentType format, e.g. application/json



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Set-PodeResponseAttachment -Path 'downloads/installer.exe'













-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Set-PodeResponseAttachment -Path './image.png'













-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Set-PodeResponseAttachment -Path 'c:/content/accounts.xlsx'













-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Set-PodeResponseAttachment -Path './data.txt' -ContentType 'application/json'















RELATED LINKS