Z.ExtensionMethods icon indicating copy to clipboard operation
Z.ExtensionMethods copied to clipboard

FileInfo.ExtractGZipToDirectory Not Working

Open adamfisher opened this issue 6 years ago • 5 comments

I was unable to get ExtractGZipToDirectory() working. It just created an empty file when I tried to decompress it. I ended up creating this method which did work:

private static FileInfo DecompressGZipFile(this FileInfo compressedFilePath)
{
	using (var fs = compressedFilePath.OpenRead())
	{
		using (var zipStream = new GZipStream(fs, CompressionMode.Decompress))
		{
			var buffer1 = compressedFilePath.Name.Split('.');
			var buffer2 = buffer1[0] + "." + buffer1[1];
			var filePath = Path.Combine(compressedFilePath.DirectoryName, buffer2);

			using (var fOutStream = new FileStream(filePath, FileMode.Create, FileAccess.Write))
			{
				var tempBytes = new byte[4096];
				int i;
				while ((i = zipStream.Read(tempBytes, 0, tempBytes.Length)) != 0)
				{
					fOutStream.Write(tempBytes, 0, i);
				}
			}

			return new FileInfo(filePath);
		}
	}
}

adamfisher avatar Dec 20 '18 14:12 adamfisher

@adamfisher ,I am new to this repo. I would like to contribute to this project. Can you please provide me steps to reproduce this issue.

prasadtelkikar avatar Dec 21 '18 12:12 prasadtelkikar

Hello @adamfisher , @prasadtelkikar ,

Thank you for reporting and your interest.

It has been a long time since the last time we really make a big change to this project. However, I still use it on a daily usage so that's for sure a project I would like to keep up to date.

I will discuss with my team and check about the future of this project and what we could plan for it.

Best Regards,

Jonathan

JonathanMagnan avatar Dec 21 '18 13:12 JonathanMagnan

Hello @adamfisher , @prasadtelkikar ,

Just to let you know what has been decided yesterday,

We finally choose to have a developer dedicated to the document in January and create a website for the documentation about our extensions methods.

Every extension methods will come with documentation and an online example using https://dotnetfiddle.net/ whenever we can.

Once the documentation is completed (or we believe enough extension has been documented), we will start to support again this library by adding some new methods/merging pull.

If you get the information you need @prasadtelkikar to fix it, feel free to provide a pull request.

As said, on our side, we will start first with the documentation for the next 1-2 months before starting to add more extensions or provide support. Best Regards,

Jonathan

JonathanMagnan avatar Dec 22 '18 14:12 JonathanMagnan

@adamfisher ,I am new to this repo. I would like to contribute to this project. Can you please provide me steps to reproduce this issue.

Just try using the ExtractGZipToDirectory() extension method on any zipped file and it fails.

adamfisher avatar Dec 25 '18 17:12 adamfisher

@prasadtelkikar Any movement on this one?

adamfisher avatar Apr 02 '20 18:04 adamfisher