New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out-Download command to enable streaming an object to client desktop from script runners. #549

Closed
AdamNaj opened this Issue Dec 29, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@AdamNaj
Member

AdamNaj commented Dec 29, 2015

You can stream an object (string, string[], Stream and byte[] types are accepted all other types will cause an error) to client's browser by using the Out-Download cmdlet now.

Syntax:
Out-Download -InputObject <Object> [-ContentType <string>] [-Name <string>]

Where:
-InputObject - object (string) to be streamed to the client
-ContentType - the Content-Type header value. "application/octet-stream" used if not provided.
-Name - name under which the content will be downloaded

Example:

Get-Item master:\content\home | 
    ConvertTo-Json -Depth 1 | 
    Out-String | 
    Out-Download -Name "home-item.json"

Byte[] streaming from media item:

Get-Content -path 'master:\media library\Default Website\sc_logo' -encoding byte -raw | 
    Out-Download -Name "sc_logo.png"

Streaming from disk drive:

[System.IO.File]::Open("C:\tmp\EvilLaugh.jpg", [System.IO.FileMode]::Open) | 
    Out-Download -Name "evil.jpg"

@AdamNaj AdamNaj added this to the 4.0 milestone Dec 29, 2015

@AdamNaj AdamNaj self-assigned this Dec 29, 2015

AdamNaj added a commit that referenced this issue Dec 29, 2015

AdamNaj added a commit that referenced this issue Jan 1, 2016

Issue #549 done. Added support for string[], Stream and byte[] on top…
… of only accepting string for Input object before.
@AdamNaj

This comment has been minimized.

Member

AdamNaj commented Jan 1, 2016

Finished. @michaellwest you can provide the fix for Excel reports (#551) now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment