Assume I have some powershell code:
function count-pipe {
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline=$true)]
[object[]]$inputObject
)
process {
$PipeCount = <# How to get count of the pipe? Expect: #> 5
Write-Output $inputObject # path-throw
}
}
1..5 | count-pipe | % { $_ }
Yes, I can sum/measure count to temp-variable and use the tee cmdlet. I think this solution make pause the pipe. I think also the temp-valiable is not a good solution relate a memory consumption.
Can I get a pipe objects count without accumulate to temp-variable?
Thanks.