Small GZIP
Small GZIP is a GZIP Compressed Data sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.
small.txt.gzArchive
単一ストリームを圧縮する形式。先頭の1F 8Bに続き、圧縮方式として通常08が入ります。
1F 8B 08 ...SIGNATURE = bytes.fromhex("1f8b08")
OFFSET = 0
def is_gz(path: str) -> bool:
with open(path, "rb") as f:
f.seek(OFFSET)
head = f.read(len(SIGNATURE))
return head == SIGNATUREconst SIGNATURE = [0x1f, 0x8b, 0x08];
const OFFSET = 0;
// bytes: a Uint8Array / Buffer holding the start of the file
export function isGz(bytes) {
return SIGNATURE.every((byte, i) => bytes[OFFSET + i] === byte);
}package fileid
import "bytes"
var isgzSignature = []byte{0x1f, 0x8b, 0x08}
const isgzOffset = 0
func IsGz(b []byte) bool {
end := isgzOffset + len(isgzSignature)
if len(b) < end {
return false
}
return bytes.Equal(b[isgzOffset:end], isgzSignature)
}const SIGNATURE: &[u8] = &[0x1f, 0x8b, 0x08];
const OFFSET: usize = 0;
fn is_gz(bytes: &[u8]) -> bool {
bytes.get(OFFSET..OFFSET + SIGNATURE.len()) == Some(SIGNATURE)
}<?php
$signature = "\x1f\x8b\x08";
$offset = 0;
function is_gz(string $bytes): bool {
global $signature, $offset;
return substr($bytes, $offset, strlen($signature)) === $signature;
}GZIP Compressed Data は圧縮、展開、バックアップ、添付、複数ファイルの検査に使われます。展開前にパス・ファイル数・圧縮後/展開後サイズを検証してください。
アーカイブには zip-slip パス、過剰な展開、隠しファイル、二重拡張子が含まれることがあります。展開パスを正規化し、ファイル数とサイズの上限を設けてください。
11 個のサンプルで、先頭バイト判定・パーサのエラー・アップロード上限・ダウンロード挙動をテストできます。
Small GZIP is a GZIP Compressed Data sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.
small.txt.gzEmpty GZIP is a GZIP Compressed Data sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.
empty.gzBlue Sky TXT.GZ is a GZIP Compressed Data sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
01-blue-sky.txt.gzbd339e2f6ecde312ad681f2dbadacb5fa40f1272a989a46e48b6ae5412d3a86bFlower Garden TXT.GZ is a GZIP Compressed Data sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
02-flower-garden.txt.gze347f058c65e3a70b8ebd7eec0df68eb345f88f13d96ff61c5ad4a6a0d3e3c14Navy Blue Sky TXT.GZ is a GZIP Compressed Data sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
03-navy-blue-sky.txt.gzf0ffbb194ac00c32c155e2ae64f5b11125fd4ade8bf8405f9cc2df876936eb66Nature of the Sky TXT.GZ is a GZIP Compressed Data sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
04-nature-sky.txt.gz26c4f012b0eb40487581dbbf95c2c6629a32b6a21aa83d47f2124794a548beb2Sky Landscape TXT.GZ is a GZIP Compressed Data sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
05-sky-landscape.txt.gz6e7bb216870b8130a07481215de2dc4f3e442b2a1bc94254e3acfbbf86fef4baStarry Sky TXT.GZ is a GZIP Compressed Data sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
06-starry-sky.txt.gz5def2c45c82871e416c64efa4e58e1367bb3b22fac3f882b0cad04eb5c83fce6Blue Night Sky TXT.GZ is a GZIP Compressed Data sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
07-blue-night-sky.txt.gze944abd9432452504192795441c70d4d411d2fb2d157704957a6e435e9f4d6d0Hibiscus Flower TXT.GZ is a GZIP Compressed Data sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
08-hibiscus-flower.txt.gze8d823308dd8f6c889030ff57aa5990f981864988e88b76436b08dc084bec84dNASA Blue Marble TXT.GZ is a GZIP Compressed Data sample based on NASA Image and Video Library. It can be used to test downloads, parsers, previews, and file type detection.
nasa-blue-marble-2012-east.txt.gz4a3d9989895a7d7cfb77d26c5369c6d539ad763fa942f4f3c16ee79910dfe7d1GZIP Compressed Data ファイルはバイトシグネチャ 1F 8B 08 ("...") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。
GZIP Compressed Data のMIMEタイプは application/gzip です。
GZIP Compressed Data ファイルは .gz, .gzip 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。