SharpZipLib | BZip2 library written entirely in C # for the .NET platform | Compression library
kandi X-RAY | SharpZipLib Summary
kandi X-RAY | SharpZipLib Summary
SharpZipLib (#ziplib, formerly NZipLib) is a compression library that supports Zip files using both stored and deflate compression methods, PKZIP 2.0 style and AES encryption, tar with GNU long filename extensions, GZip, zlib and raw deflate, as well as BZip2. Zip64 is supported while Deflate64 is not yet supported. It is implemented as an assembly (installable in the GAC), and thus can easily be incorporated into other projects (in any .NET language). The creator of SharpZipLib put it this way: "I've ported the zip library over to C# because I needed gzip/zip compression and I didn't want to use libzip.dll or something like this. I want all in pure C#.". SharpZipLib was originally ported from the GNU Classpath java.util.zip library for use with SharpDevelop, which needed gzip/zip compression. bzip2 compression and tar archiving were added later due to popular demand. The SharpZipLib homepage has precompiled libraries available for download, API documentation, release history, samples and more.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SharpZipLib
SharpZipLib Key Features
SharpZipLib Examples and Code Snippets
Community Discussions
Trending Discussions on SharpZipLib
QUESTION
I am learning F# and Deedle. I am trying to extract the contents of this TGZ File using SharpZipLib. I downloaded the TGZ to my local drive. I think I am close because out1 works, but out2 errs. I am sure the code could be written better with pipe forwarding or composition, but it first needs to work. Does anyone have any ideas?
...ANSWER
Answered 2022-Feb-22 at 01:44Does this help?
https://stackoverflow.com/a/52200001/1594263
Looks like you should be using CreateInputTarArchive(). I modified your example to use CreateInputTarArchive(), and it worked for me.
BTW you're just assigning a function to out1, you're not actually calling ListContents().
QUESTION
How to make nuget package:moderenwpfui generate only needed language files.
The repository for this nuget package is https://github.com/Kinnara/ModernWpf .
When I generate my app, a lot of language files will be generated. Is there a way to generate only the language I need or preset the language file to the language I use?
The following are all the files generated in the Debug directory, the one without the suffix is the folder, the folder contains the dll library for the language files
ANSWER
Answered 2022-Feb-09 at 09:30Under Project>References you will find ModernWpf
and ModernWpf.Controls
. You need to set the property Copy Local
to False
for both of them.
Before you do that, backup these files and copy them manually to debug folder after doing the above steps.
QUESTION
In this website I found several examples for reading a .tar achieve using SharpLibZip.
QuestionIn my case however I'd like to make sure that entries are read in a specific order based on their names. Is there an easy way to do so?
More detailsMy .tar archive contains monthly data with per-day files (file-01
, file-02
, ..., file-31
). However, the data provider doesn't seem to pay attention while creating the .tar file and the entries seem to arrive in a random order.
ANSWER
Answered 2022-Feb-02 at 18:33You would need to write your own tar decoder. It is up to you to say if you would consider this to be "easy" or not. The tar format is pretty simple.
You would need to first scan through the tar file to find all the headers, saving the file name and the offset and length of the file data for each. Then you could seek back and forth to the offset of any file to read its contents.
This would be much more difficult if the tar file were compressed, e.g. if it were a .tar.gz
file, as opposed to a .tar
file.
The tar format is documented here.
Update:
In a comment, the OP revealed that it is actually a .tar.bz2
file. As noted, that requires additional work to be able to randomly access entries. In addition to building an index to the tar contents, the entire .bz2
file needs to be read to build an index to the compression entry points, which do not correspond to where files start in the tar archive. Then to access a file you first would go to the closest bzip2 entry point that precedes the start of that file data, and decompress from there until you arrive at and then read out that data.
It would be easier to simply rearchive and recompress the files into the zip format, which is designed to randomly access and extract individual entries.
QUESTION
I'm writing there because I'm actually experiencing an issue in which I'm not sure what is the cause.
It is impossible to send a package to the Microsoft Store, it is automatically refused (Can't even send it to certification process).
When I'm sending the application's package onto the Microsoft Store, after the validation process, the popup is closed an I get an error message saying :
Value cannot be null , parameter : source
The package compiles fine and I get no errors. (For more clarifications, it's a Desktop Bridge UWP because it uses runFullTrust, but it always worked before).
Due to huge problem of compilation with a library called DotNetZip (The package won't compile on release mode), I switched to another library called SharpZipLib, which is now working really nice and I don't get any issue when compiling (getting a good msixupload that can be opened).
So, I'm wondering if the issue is related with the Microsoft Store servers or with the app itself.
Thank you in advance, and don't hesitate to ask if anything is needed to be added to this question.
...ANSWER
Answered 2021-Jul-14 at 09:52In case someone encounters the same issue, here is a short answer on how to fix the issue.
- Right click on the Desktop Bridge Package
- Select Manage NuGet packages
- Uninstall the package SDK.Buildtools
You should now be able to compile the package and publish it on the store.
QUESTION
SharpZipLib is a .Net implementation for Java library for working with archives. It provides ZipOutputStream class, which derives from DeflaterOutputStream and has Finish() method. In the docs here it is stated that the Finish() method "will write the central directory at the end of the zip file and flush the stream" and that it "is automatically called when the stream is closed". So I wonder if I should call Finish() method at all if I call Close() anyway.
UPDATE: the question should have been stated another way: why should I use Finish() method if I can call Dispose() or Close() that will do the job (including calling Finish() method)?
...ANSWER
Answered 2021-Jun-24 at 13:35From the documentation of ZipOutputStream - Finish():
This is automatically called when the stream is closed.
As for the closing, the ZipOutputStream
needs to be properly disposed. There is no need to call for Close
method.
QUESTION
Background: I am testing compression ratio for our device. From device the data is sent as Json payloads. It's a JArray format. I will get the size of this data in Bytes. It goes to converter. In converter this data is been compressed using Zlib library implemented in NodeJS. I don't have access to this code. And I don't know NodeJS. I know only C#.
Is that okay to do compression using SharpZipLib or any other GZip compression library in .Net to replicate the job of the converter. How much accurate it will be? Will the compression vary largely because of using different libraries?
...ANSWER
Answered 2021-May-25 at 09:38The compression ratio will be mostly depending on the compression algorithm and what compression settings are used. Deflate is one of the most common. I would not expect any significant difference in size.
But even if the same algorithm is used there might be different headers used by different libraries. If you want backward compatibility you need to have a library that is compatible. See also zip vs gzip vs zlib.
The best way to check if there is any size difference or backward compatibility issues is to test it.
QUESTION
My string is a Json file (test.json) with the below content
...ANSWER
Answered 2021-May-25 at 15:47Your benchmark has some fairly fundamental problems:
- You're using UTF-16 to encode the input string to bytes when calculating its length (
UTF8Encoding.Unicode
is just an unclear way of writingEncoding.Unicode
, which is UTF-16). That encodes to 2 bytes per character, but most of those bytes will be 0. - You're base64-encoding your output. While this is a way to print arbitrary binary data as text, it uses 4 characters to represent 3 bytes of data, so you're increasing the size of your output by 33%.
- You're then using UTF-16 to turn the base64-encoded string into bytes again, which takes 2 bytes per character again. So that's an artificial 2x added to your result...
It so happens that the two uses of UTF-16 more-or-less cancel out, but the base64-encoding bit is still responsible for a lot of the discrepancies you're seeing.
Take that out, and you get a compression ratio of: 0.80338985.
That's not bad, given that compression introduces overheads: there's data which always needs to appear in a GZip stream, and it's there regardless of how well your data compresses. You can only really expect compression to make any significant difference on larger inputs.
QUESTION
I have a zip file which contains inner zip file (Ex:ZipFile1.zip->ZipFile2.zip->file.txt). I want to read the data of inner archive file content (file.txt) using ICSharpCode.SharpZipLib library without extracting to disk. Is it possible? If it is possible, Let me know how to get this.
...ANSWER
Answered 2021-Apr-22 at 08:44Based on this answer, you can open a file within the zip as a Stream
. You can also open a ZipFile
from a Stream
. I'm sure you can see where this is heading.
QUESTION
I'm developing a web application using .Net Core and leveraging Azure services (Virtual Machine Windows Server 2016, Database PostgreSQL and Azure Key Vault). Below is my .csproj file:
...ANSWER
Answered 2021-Mar-17 at 15:03I solved the problem by installing the Azure CLI and logging in as described here: https://docs.microsoft.com/cli/azure/install-azure-cli-windows?tabs=azure-cli
QUESTION
I am Using DotNetZip (from NuGet Package). This will normally work for a File path having ("@C:) but once if use the Cloud File Path like (https:) it is giving me IBM437 error. I can use this package but need to introduce some encoding which is the other problem.
I tried using SharpZipLib (another NuGet Package) but couldn’t find any information on internet related to it for a Cloud File Path. (http:).
I also tried Spire PDF but it throws File doesn't exist (Parameter 'fileName') error for password protected PDF.
URL’s for NuGet Packages - DotNetZip - https://www.nuget.org/packages/DotNetZip/ SharpZipLib- https://www.nuget.org/packages/SharpZipLib.NETStandard/
Please let me know if any more information is required.
...ANSWER
Answered 2021-Mar-10 at 04:23You can try to download the .pdf file as a local temp file and then check could open it without a password. Just try the C# console app below:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install SharpZipLib
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page