Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicPythonRubySQL ServerSwiftTclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcel

.NET Core C# Examples


ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Bounced Email
Box
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
ECC
Email Object
Encryption
FTP
Facebook
Firebase
GeoOp
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)

Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Shopify
Socket/SSL/TLS
Spider
Stream
Stripe
SugarCRM
Tar Archive
Twitter
VoiceBase
Walmart
WebSocket
XML
XML Digital Signatures
XMP
Xero
Zip
curl
eBay

 

 

 

(.NET Core C#) Download a Zip from a URL and OpenFromMemory. (No .zip fie is created)

Demonstrates how to download a .zip from a URL, opens the Zip, and gets the contents of a file. No file is ever written.

Chilkat .NET Downloads

Chilkat .NET Assemblies

Chilkat for .NET Core

Chilkat for Mono

Chilkat for Xamarin

//  This example requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

Chilkat.Http http = new Chilkat.Http();

byte[] zipFileBytes = null;
//  This URL is valid and can be tested...
zipFileBytes = http.QuickGet("http://chilkatdownload.com/example_data/hamlet.zip");
if (http.LastMethodSuccess != true) {
    Console.WriteLine(http.LastErrorText);
    return;
}

Chilkat.Zip zip = new Chilkat.Zip();

//  Open the zip from the in-memory bytes.
bool success = zip.OpenFromMemory(zipFileBytes);
if (!success) {
    Console.WriteLine(zip.LastErrorText);
    return;
}

//  Get the entry for the file we want..
Chilkat.ZipEntry entry = zip.GetEntryByName("hamlet.xml");
if (zip.LastMethodSuccess != true) {
    Console.WriteLine(zip.LastErrorText);
    return;
}

//  Convert all line endings to CRLF (if needed)
int lineEndingBehavior = 2;
string xmlStr = entry.UnzipToString(lineEndingBehavior,"utf-8");
if (entry.LastMethodSuccess != true) {
    Console.WriteLine(entry.LastErrorText);

    return;
}

//  The XML in this case is about 274K, so let's just examine the last 20 lines...
Chilkat.StringBuilder sb = new Chilkat.StringBuilder();
sb.Append(xmlStr);

Console.WriteLine(sb.LastNLines(20,true));


 

© 2000-2016 Chilkat Software, Inc. All Rights Reserved.