Skip to content

Use-PodeStream

SYNOPSIS

Like the "using" keyword in .NET. Allows you to use a Stream and then disposes of it.

SYNTAX

Use-PodeStream [-Stream] <IDisposable> [-ScriptBlock] <ScriptBlock> [<CommonParameters>]

DESCRIPTION

Like the "using" keyword in .NET. Allows you to use a Stream and then disposes of it.

EXAMPLES

EXAMPLE 1

$content = (Use-PodeStream -Stream $stream -ScriptBlock { return $args[0].ReadToEnd() })

PARAMETERS

-ScriptBlock

The ScriptBlock to invoke. It will be supplied the Stream.

Type: ScriptBlock
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Stream

The Stream to use and then dispose.

Type: IDisposable
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Object

NOTES