< Back

Use-PodeStream

Sat Jan 18, 2020 7:21 pm

NAME 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.





PARAMETERS

-Stream <IDisposable>

The Stream to use and then dispose.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ScriptBlock <ScriptBlock>

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



Required? true

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

System.Object





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



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















RELATED LINKS