Two File TAR
Two File TAR is a Tape Archive sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.
two-files.tarArchive
複数ファイルを連結して格納するアーカイブ形式。512バイト単位のヘッダとデータブロックで構成されます。
75 73 74 61 72 ustarSIGNATURE = bytes.fromhex("7573746172")
OFFSET = 257
def is_tar(path: str) -> bool:
with open(path, "rb") as f:
f.seek(OFFSET)
head = f.read(len(SIGNATURE))
return head == SIGNATUREconst SIGNATURE = [0x75, 0x73, 0x74, 0x61, 0x72];
const OFFSET = 257;
// bytes: a Uint8Array / Buffer holding the start of the file
export function isTar(bytes) {
return SIGNATURE.every((byte, i) => bytes[OFFSET + i] === byte);
}package fileid
import "bytes"
var istarSignature = []byte{0x75, 0x73, 0x74, 0x61, 0x72}
const istarOffset = 257
func IsTar(b []byte) bool {
end := istarOffset + len(istarSignature)
if len(b) < end {
return false
}
return bytes.Equal(b[istarOffset:end], istarSignature)
}const SIGNATURE: &[u8] = &[0x75, 0x73, 0x74, 0x61, 0x72];
const OFFSET: usize = 257;
fn is_tar(bytes: &[u8]) -> bool {
bytes.get(OFFSET..OFFSET + SIGNATURE.len()) == Some(SIGNATURE)
}<?php
$signature = "\x75\x73\x74\x61\x72";
$offset = 257;
function is_tar(string $bytes): bool {
global $signature, $offset;
return substr($bytes, $offset, strlen($signature)) === $signature;
}Tape Archive は圧縮、展開、バックアップ、添付、複数ファイルの検査に使われます。展開前にパス・ファイル数・圧縮後/展開後サイズを検証してください。
アーカイブには zip-slip パス、過剰な展開、隠しファイル、二重拡張子が含まれることがあります。展開パスを正規化し、ファイル数とサイズの上限を設けてください。
11 個のサンプルで、先頭バイト判定・パーサのエラー・アップロード上限・ダウンロード挙動をテストできます。
Two File TAR is a Tape Archive sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.
two-files.tarBlue Sky TAR is a Tape Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
01-blue-sky.tar4f2498abfbfb9ee74180bf3a02b3a8f976fd16dc33c134c4c307529d46665609Flower Garden TAR is a Tape Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
02-flower-garden.tarff19afd6572cafd772d5a916145fac852e97180fd8b2c0ab8b2bd05509c82a55Navy Blue Sky TAR is a Tape Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
03-navy-blue-sky.tar033cb4ba37d05f5256393369723ef400609baca455d8a72d53c145097a4e7c2cNature of the Sky TAR is a Tape Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
04-nature-sky.tar248e75969993dea282935a0309e494434cc97dfaa6b088cf22e216319771a9ddSky Landscape TAR is a Tape Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
05-sky-landscape.tar37f26144c9d8cab02adcce041bc704ca1c62f8dfbf371cfc4f36a16c73e7b8ccStarry Sky TAR is a Tape Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
06-starry-sky.tarf6a45473e6b56103b67b0dd72518b907b4c1c1cb2ab885e484625000a655118aBlue Night Sky TAR is a Tape Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
07-blue-night-sky.tarc4a343ba04c0a27cd56fa9d5da7acfda7bd6165e1f68b9921f7aabaa45729030Hibiscus Flower TAR is a Tape Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
08-hibiscus-flower.tar0b5000a03369440888b0a8af7bf783f0b349ccc83a44e48c5a1c76f7ca9d513aArctic Sky TAR is a Tape Archive sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
09-arctic-sky.tarbff79945ec6c8e58b31a7dc7061bd11ca8eca8b8c11f90920c8c4dfc9fdacc17NASA Blue Marble TAR is a Tape Archive 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.tar5314e1c9674de2f0f3f14d952c33991501d04c902b6f5fa22dc70760bac6da35Tape Archive ファイルはバイトシグネチャ 75 73 74 61 72 ("ustar") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。
Tape Archive のMIMEタイプは application/x-tar です。
Tape Archive ファイルは .tar 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。