Pascal (Lazarus/Delphi)
Pascal (Lazarus/Delphi)
Get a Blob using a Container's Shared Access Signature
See more Azure Cloud Storage Examples
Shows how to download an Azure blob using a URL with a shared access signature.Chilkat Pascal (Lazarus/Delphi) Downloads
program ChilkatDemo;
// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
SysUtils,
CkDllLoader,
Chilkat.Http;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
success: Boolean;
url: string;
http: THttp;
begin
success := False;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
url := 'https://chilkat.blob.core.windows.net/mycontainer/starfish.jpg?sv=2021-06-08&ss=bfqt&srt=sco&sp=rwdlacupiyx&se=2023-02-12T21:30:53Z&st=2023-02-12T13:30:53Z&spr=https&sig=HB8CoZiD7EJD1rQNIVnLl%2Bq7kyLcOCnSXR14TadBv6s%3D';
// To download to a file, pass the full URL with query params to the Download method.
http := THttp.Create;
success := http.Download(url,'c:/someDir/starfish.jpg');
if (success = False) then
begin
WriteLn('response status code: ' + http.LastStatus);
WriteLn('response status text: ' + http.LastStatusText);
Exit;
end;
WriteLn('Success.');
http.Free;
end;
// ---------------------------------------------------------------------------
begin
try
RunDemo;
except
on E: Exception do
WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
end;
WriteLn;
{$IFDEF MSWINDOWS}
WriteLn('Press Enter to exit...');
ReadLn;
{$ENDIF}
end.