emptygif
ਭਾਸ਼ਾ: ਪੰਜਾਬੀ

ਸਾਰੀਆਂ ਭਾਸ਼ਾਵਾਂ ਅਤੇ ਫਰੇਮਵਰਕ

Pode PowerShell

Pode ਲਈ PowerShell ਸਨਿੱਪਟ, ਜੋ /pixel.gif ਦੀਆਂ ਬੇਨਤੀਆਂ ਦਾ ਜਵਾਬ ਖਾਲੀ GIF ਨਾਲ ਦਿੰਦਾ ਹੈ; GIF ਸ਼ੁਰੂਆਤ ’ਤੇ ਇੱਕ ਵਾਰ ਡੀਕੋਡ ਹੁੰਦੀ ਹੈ।

Pode PowerShell

ਇੰਸਟਾਲ
Install-Module -Name Pode
ਫਾਈਲ
server.ps1
ਚਲਾਓ
pwsh ./server.ps1
Import-Module Pode

Start-PodeServer {
    Add-PodeEndpoint -Address * -Port 8080 -Protocol Http
    Set-PodeState -Name 'Gif' -Value ([Convert]::FromBase64String('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')) | Out-Null

    Add-PodeRoute -Method Get -Path '/pixel.gif' -ScriptBlock {
        Set-PodeHeader -Name 'Cache-Control' -Value 'no-store'
        # Pode appends '; charset=utf-8' to the type; browsers ignore it for images.
        Write-PodeTextResponse -Bytes (Get-PodeState -Name 'Gif') -ContentType 'image/gif'
    }
}

ਅਸੀਂ ਇਹ ਸਨਿੱਪਟ ਚਲਾਇਆ ਅਤੇ ਇਸ ਵੱਲੋਂ ਵਾਪਸ ਕੀਤੀਆਂ ਬਾਈਟਾਂ ਦੀ ਤੁਲਨਾ ਕੀਤੀ।

ਜਾਂਚੋ

curl -sI http://localhost:8080/pixel.gif

ਅਧਿਕਾਰਤ ਸਾਈਟ: Pode

PowerShell ਵਿੱਚ ਹੋਰ