Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Easy Zip

An asset by chairfull
The page banner background of a mountain and forest
Easy Zip hero image

Quick Information

0 ratings
Easy Zip icon image
chairfull
Easy Zip

Easily zip a bunch of files for save games or level editors!Support images, nodes, resources, and built in types like dictionaries.**API**```gd# Write files by passing as a zip, with names as file paths.Zip.write("user://slot0.save", {"state.var": {"score": 10, "name": "player"}, "scene.scn": get_tree().current_scene(), "screen.jpg": screenshot })# Append works the same but without erasing data.Zip.append()# Automatically snaps, shrinks, and appends to the file.Zip.write_screenshot("user://slot.zip", get_viewport())# Automatically converts bytes to the appropriate format.# .tscn and .scn will come back as a PackedScene.Zip.read("user://slot.zip", "screen.jpg")# Get a list paths that match the head and tail.Zip.get_files("user://slot0.save", "", ".png")# Remove a list of files.Zip.remove("user://custom_map.map", ["area1.scn", "area2.scn"])```**Check the README for more details.**

Supported Engine Version
4.3
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
8 months ago
Git URL
Issue URL

Easy Zip

v1.0

Write multiple files to a zip.

Ideal for save systems + level editors.

Autoconverts:

  • Dictionary -> (.json or .var) -> bytes
  • String -> bytes
  • Image -> (.png, .jpg/jpeg, .webp, .svg) -> bytes
  • Resource -> (.tres or .res) -> bytes
  • Node -> (.tscn or .scn) -> bytes

Saving files as file.json will use JSON.stringify, while file.var will use Godots var_to_str which supports built in formats.

Usage

Writing

Zip.write("user://data.zip", {
    "version.txt": "123",
    "state.json": {"score": 10, "position": [0.0, 0.0]},
    "state.var": {"score": 10, "position": Vector2(0.0, 0.0)},
    "image.webp": Image,
    "bytes.data": PackedByteArray(),
    "current_scene.tscn": get_tree().current_scene,
})

kwargs

  • lossy: (bool) Used for .webp
  • quality: (float) Used for .jpg & .webp
  • flags: (ResourceSave.FLAG_) Used for saving resources

Reading

var current_scene = Zip.read("user://data.zip", "current_scene.tscn")

Other

# For kwargs look above.
# You don't have to call await before it, but it's ideal.
await Zip.write_screenshot("user://data.slot", get_viewport(), "name_and_ext.jpeg", shrink, kwargs)

# List of files you want removed from the zip.
Zip.remove("user://data.slot", ["file.json", "screenshot.jpg"])

# Exactly like write() but preserves the previous content if it exists.
Zip.append("user://data.slot", {"image.jpg": image})

Easily zip a bunch of files for save games or level editors!

Support images, nodes, resources, and built in types like dictionaries.

**API**
```gd
# Write files by passing as a zip, with names as file paths.
Zip.write("user://slot0.save", {"state.var": {"score": 10, "name": "player"}, "scene.scn": get_tree().current_scene(), "screen.jpg": screenshot })
# Append works the same but without erasing data.
Zip.append()

# Automatically snaps, shrinks, and appends to the file.
Zip.write_screenshot("user://slot.zip", get_viewport())

# Automatically converts bytes to the appropriate format.
# .tscn and .scn will come back as a PackedScene.
Zip.read("user://slot.zip", "screen.jpg")

# Get a list paths that match the head and tail.
Zip.get_files("user://slot0.save", "", ".png")

# Remove a list of files.
Zip.remove("user://custom_map.map", ["area1.scn", "area2.scn"])
```

**Check the README for more details.**

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Easy Zip icon image
chairfull
Easy Zip

Easily zip a bunch of files for save games or level editors!Support images, nodes, resources, and built in types like dictionaries.**API**```gd# Write files by passing as a zip, with names as file paths.Zip.write("user://slot0.save", {"state.var": {"score": 10, "name": "player"}, "scene.scn": get_tree().current_scene(), "screen.jpg": screenshot })# Append works the same but without erasing data.Zip.append()# Automatically snaps, shrinks, and appends to the file.Zip.write_screenshot("user://slot.zip", get_viewport())# Automatically converts bytes to the appropriate format.# .tscn and .scn will come back as a PackedScene.Zip.read("user://slot.zip", "screen.jpg")# Get a list paths that match the head and tail.Zip.get_files("user://slot0.save", "", ".png")# Remove a list of files.Zip.remove("user://custom_map.map", ["area1.scn", "area2.scn"])```**Check the README for more details.**

Supported Engine Version
4.3
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
8 months ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers