Giter Site home page Giter Site logo

gdunzip's People

Contributors

ajver avatar eirexe avatar jellehermsen avatar sylvansign avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gdunzip's Issues

Invalid get index 'files' (on base: 'GDScript').

here's my code, I'm trying to extract the files from a zip.

	$HTTPRequest.request("https://skse.silverlock.org/beta/skse64_2_01_05.7z")
 
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
	var file = File.new()
	file.open_compressed("skse64_2_01_05.7z", File.WRITE, 0)
	file.store_buffer(body)
	var loaded = gdunzip.load('res://skse64_2_01_05.7z')
	if loaded:
		var uncompressed = gdunzip.uncompress('lorem.txt')
		if !uncompressed:
			print('Failed uncompressing lorem.txt')
		else:
			print(uncompressed.get_string_from_utf8())
	else:
		print('Failed loading zip file')
	
	for f in gdunzip.files.values():
		print('File name: ' + f['file_name'])

	# "compression_method" will be either -1 for uncompressed data, or
	# File.COMPRESSION_DEFLATE for deflate streams
		print('Compression method: ' + str(f['compression_method']))

		print('Compressed size: ' + str(f['compressed_size']))

		print('Uncompressed size: ' + str(f['uncompressed_size']))```

AssetLib version is 1.0.0

The version of this project uploaded to AssetLib is 1.0.0, missing the newer patches that actually make the script work: just downloaded it from there and got the #7 error.

Invalid get index <code> opening a .zip file

Hello,
I'm trying to unzip a .zip folder containing only two text files, an .md and a .txt.
When I try to extract files from it, an error prints in console:
error

Here it is the code:

var unzipper = load("res://addons/github-integration/resources/extraction/gdunzip.gd").new()
[...]
func extraction_process():
	var archive = unzipper.load_archive(zip_filepath)
	var uncompressed_file : File = File.new()
	if archive:
		for file in unzipper.files:
			var uncompressed = unzipper.uncompress(file)
			if uncompressed:
				uncompressed_file.open("res://uncompressed/"+file,File.WRITE)
				uncompressed_file.store_string(uncompressed.get_string_from_utf8())
				uncompressed_file.close()

where zip_filepath is just the path to the zip I'm getting after a download.

And I'm attaching the zip too, if you need to test.

my-br-app-linux.zip

Thank you very much for your support, waiting for your response, if you need anything more.

Unicode error: invalid skip and missing files/folders

Hello!
The script now works fine and is actually really fast.
But sometimes there is a strange bug happening while uncompressing some folders/files.

In console appears a Unicode error: invalid skip message, even though it doesn't seem to be an error, and there are not unrecognized characters in folders/files names.

When this happens, the script skips folders and directly uncompresses files.

I hope you will be able to reproduce the issue and understand it better with my resources.

func extraction_process():
	var archive = unzipper.load(zip_filepath)
	if archive:
		var root : String = unzipper.files.values()[0].file_name
		for file in unzipper.files.values():
			var uncompressed = unzipper.uncompress(file.file_name)
			if uncompressed:
				#print("File:" +file.file_name.lstrip(root))
				if file.file_name.lstrip(root).get_base_dir()!='':
					var dir : Directory = Directory.new()
					dir.make_dir("res://uncompressed/"+file.file_name.lstrip(root).get_base_dir())
					#print("Directory:" +file.file_name.lstrip(root).get_base_dir())
				var uncompressed_file : File = File.new()
				uncompressed_file.open("res://uncompressed/"+file.file_name.lstrip(root),File.WRITE)
				uncompressed_file.store_string(uncompressed.get_string_from_utf8())
				uncompressed_file.close()
  • Console output:
    rere
  • Actual uncompressed output:
    exported

godot engine 3.2beta2

" Parse error: Invalid numeric constant at 'b' "

Hi, I'm trying to use your plugin in Godot Engine 3.2beta1 to implement it inside one of my plugins.
Currently I'm having some problems integrating your code, and since I don't want to mess it up I'll just share with you what is the issue right now.

zip1

Error when decompressing

Hi,

Thank you for this addon.

I'm having problems to uncompress the file "song.egg" from this File
It looks like the code gets stuck in an endless loop.

The code I'm using is:

	var gdunzip = load('res://addons/gdunzip/gdunzip.gd').new()
	var loaded = gdunzip.load(zip_file)
	var uncompressed = gdunzip.uncompress(fileName)
        return uncompressed

where
zip_file: is the path to the zip file
fileName: is "song.egg"

error(335, 7): Variable "i" already defined in the scope (at line 332).

error(335, 7): Variable "i" already defined in the scope (at line 332).
gdunzip.gd line 335:

	func tinf_build_bits_base(target, delta, first):
		var i = 0
		var sum = first

		for i in range(0, delta):
			base_tables[target + '_bits'][i] = 0

		for i in range(0, 30 - delta):
			base_tables[target + '_bits'][i + delta] =  i / delta

		for i in range(0, 30):
			base_tables[target + '_base'][i] = sum
			sum += 1 << base_tables[target + '_bits'][i]```

Update to Godot v4

A few things got changed like Pool into Packed and stuff, I tried looking into it but it seems that it needs a deeper rewrite.

Performance improvements for inflator

The current inflator is a pretty straightforward port of Tinf. I suspect there's a lot of tiny performance improvements that can be made.

  • I have converted most for loops using "range", but range creates an array up front. It would probably be faster to convert those to while loops
  • I have used PoolByteArrays all over the place. This might be beneficial for the main source and destination arrays since they can be pretty large. The tinier arrays might however be better served by using regular arrays.
  • I'm not entirely sure that the way I have mimicked pointers by adding sourcePtr and destPtr is a good idea performance-wise. There might be some potential improvements there.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.