mirror of
https://github.com/0x5eal/luau-unzip.git
synced 2025-04-08 08:10:54 +01:00
style: apply stylua formatter
This commit is contained in:
parent
48a66800b7
commit
ecb63a0e2d
1 changed files with 31 additions and 23 deletions
|
@ -33,14 +33,15 @@ local function validateCrc(decompressed: buffer, validation: CrcValidationOption
|
||||||
end
|
end
|
||||||
|
|
||||||
export type CompressionMethod = "STORE" | "DEFLATE"
|
export type CompressionMethod = "STORE" | "DEFLATE"
|
||||||
local DECOMPRESSION_ROUTINES: { [number]: { name: CompressionMethod, decompress: (buffer, number, CrcValidationOptions) -> buffer } } = table.freeze({
|
local DECOMPRESSION_ROUTINES: { [number]: { name: CompressionMethod, decompress: (buffer, number, CrcValidationOptions) -> buffer } } =
|
||||||
|
table.freeze({
|
||||||
-- `STORE` decompression method - No compression
|
-- `STORE` decompression method - No compression
|
||||||
[0x00] = {
|
[0x00] = {
|
||||||
name = "STORE" :: CompressionMethod,
|
name = "STORE" :: CompressionMethod,
|
||||||
decompress = function(buf, _, validation)
|
decompress = function(buf, _, validation)
|
||||||
validateCrc(buf, validation)
|
validateCrc(buf, validation)
|
||||||
return buf
|
return buf
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- `DEFLATE` decompression method - Compressed raw deflate chunks
|
-- `DEFLATE` decompression method - Compressed raw deflate chunks
|
||||||
|
@ -52,7 +53,7 @@ local DECOMPRESSION_ROUTINES: { [number]: { name: CompressionMethod, decompress:
|
||||||
local decompressed = inflate(buf, uncompressedSize :: any)
|
local decompressed = inflate(buf, uncompressedSize :: any)
|
||||||
validateCrc(decompressed, validation)
|
validateCrc(decompressed, validation)
|
||||||
return decompressed
|
return decompressed
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -73,7 +74,14 @@ type ZipEntryInner = {
|
||||||
children: { ZipEntry }, -- The children of the entry
|
children: { ZipEntry }, -- The children of the entry
|
||||||
}
|
}
|
||||||
|
|
||||||
function ZipEntry.new(name: string, size: number, offset: number, timestamp: number, method: CompressionMethod?, crc: number): ZipEntry
|
function ZipEntry.new(
|
||||||
|
name: string,
|
||||||
|
size: number,
|
||||||
|
offset: number,
|
||||||
|
timestamp: number,
|
||||||
|
method: CompressionMethod?,
|
||||||
|
crc: number
|
||||||
|
): ZipEntry
|
||||||
return setmetatable(
|
return setmetatable(
|
||||||
{
|
{
|
||||||
name = name,
|
name = name,
|
||||||
|
|
Loading…
Add table
Reference in a new issue