Skip to content

A simple library that provides archiving functionality via FastLZ within Garry's Mod.

License

Notifications You must be signed in to change notification settings

MiBShidobu/libcompress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

libcompress By MiBShidobu

GitHub RepositoryGitHub Page

Description:

A simple library that provides archiving functionality via FastLZ within Garry's Mod.

Downloading:

This repository is in project format with all the different files and the like, see the releases page for small streamlined releases.

Dependencies:

Usage:

-- Compression
require("libcompress")

local test_file_one = file.Read("lua/includes/init.lua", "GAME")
local test_file_two = file.Read("lua/includes/init_menu.lua", "GAME")

local lz_archive = libcompress.LZArchive()
lz_archive:file("init.lua", test_file_one)
lz_archive:file("init_menu.lua", test_file_two)

local compressed_data = lz_archive:get_archive()
file.Write("test_archive.flz.txt", compressed_data)

-- Decompression
require("libcompress")

local compressed_data = file.Read("data/test_archive.flz.txt", "GAME")

local lz_archive = libcompress.LZArchive(compressed_data)
PrintTable(lz_archive:get_files()) --[[
	1	=	init.lua
	2	=	init_menu.lua
]]--

for _, file_name in ipairs(lz_archive:get_files("**.lua")) do
    -- Can filter files too, using ** instead of * keeps it to the same directory level
    print("File:", file_name)
    print(lz_archive:file(file_name)) -- Decompresses and prints the content
end

Credits:

MiBShidobuSteam - Project Maintainer

About

A simple library that provides archiving functionality via FastLZ within Garry's Mod.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages