Write-KrBinaryResponse
SYNOPSIS
Writes binary data directly to the HTTP response body.
SYNTAX
__AllParameterSets
Write-KrBinaryResponse [-InputObject] <byte[]> [[-StatusCode] <int>] [[-ContentType] <string>]
[<CommonParameters>]
ALIASES
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION
Sends a byte array to the client. Useful for returning images or other binary content with a specified status code and content type.
EXAMPLES
EXAMPLE 1
Write-KrBinaryResponse -InputObject $myBinaryData -StatusCode 200 -ContentType “application/octet-stream” Writes the $myBinaryData to the response body with a 200 OK status code and content type “application/octet-stream”.
PARAMETERS
-ContentType
The content type of the response. If not specified, defaults to “application/octet-stream”.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-InputObject
The binary data to write to the response body. This should be a byte array.
Type: System.Byte[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-StatusCode
The HTTP status code to set for the response. Defaults to 200 (OK).
Type: System.Int32
DefaultValue: 200
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
OUTPUTS
NOTES
This function is designed to be used in the context of a Kestrun server response.
RELATED LINKS
{{ Fill in the related links here }}