file in abyss
フォーマット一覧へ戻る

Data

CSV Comma-Separated Values

表形式データをカンマ区切りで表すテキスト形式。ヘッダ行を持つことが多いです。

Extensions .csv
MIME text/csv

マジックナンバー

ファイルを解析
オフセット 0 Header row used by the sample
6E 61 6D 65
name

構造

  1. Rows
  2. Fields
  3. Optional header
  4. Quoted values

注意点

  • CSVには固定マジックナンバーがなく、区切り文字や改行規則も実装差があります。

判定コード例

SIGNATURE = bytes.fromhex("6e616d65")
OFFSET = 0

def is_csv(path: str) -> bool:
    with open(path, "rb") as f:
        f.seek(OFFSET)
        head = f.read(len(SIGNATURE))
    return head == SIGNATURE

実践的な使い方

ユースケース

Comma-Separated Values はデータ交換、インポート/エクスポート、パーサのテスト、検証ワークフローで使われます。エンコーディング・区切り文字・バージョン・コンテナ構造が実装の挙動を変えることがあります。

よくある判定ミス

  • .csv という拡張子だけではファイルの中身を保証できません。アップロードや変換の処理では、拡張子・MIMEタイプ・先頭バイト・形式固有の構造チェックを組み合わせるべきです。
  • Comma-Separated Values は 6E 61 6D 65 のようなシグネチャで始まりますが、関連するコンテナや破損ファイルでは追加の検証が必要になる場合があります。

セキュリティ上の注意

形式が判定できたからといって、信頼できない入力が安全とは限りません。パーサ例外・巨大ファイル・想定外のエンコーディング・外部参照を考慮してください。

サンプルの活用

11 個のサンプルで、先頭バイト判定・パーサのエラー・アップロード上限・ダウンロード挙動をテストできます。

サンプルファイル

11 / 11 files
Sample Traits Size Source / license / SHA-256
Data

Nature Colors CSV

Nature Colors CSV is a Comma-Separated Values sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.

colors.csv
Type Sample
Small file
92 B
Generated CC0 1.0
SHA-256 1c9c8cd3d3388f7d601422bb14277c58fa793a60e5d016aa77d8103aa1390d07
Download
Data

Blue Sky CSV

Blue Sky CSV is a Comma-Separated Values sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

01-blue-sky.csv
Type Sample
Small file
141 B
SHA-256 b8c6c6d1304a6df369a2b23d14b71290e241a44c112e45cf0b0318c8534bd0ba
Download
Data

Flower Garden CSV

Flower Garden CSV is a Comma-Separated Values sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

02-flower-garden.csv
Type Sample
Small file
293 B
SHA-256 82f01fead0843a36da2ed3529a31ef75daa64cef329b52fed148fb560102d7f3
Download
Data

Navy Blue Sky CSV

Navy Blue Sky CSV is a Comma-Separated Values sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

03-navy-blue-sky.csv
Type Sample
Small file
396 B
SHA-256 77e2d7b1e7b2cf616ba094d5993cb6249cf2a66427c86daa6db305d64422e4bc
Download
Data

Nature of the Sky CSV

Nature of the Sky CSV is a Comma-Separated Values sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

04-nature-sky.csv
Type Sample
Small file
483 B
SHA-256 8fe507787be70647e108aa5264392d433c495732c1e6ff37602e3514551fd1e1
Download
Data

Sky Landscape CSV

Sky Landscape CSV is a Comma-Separated Values sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

05-sky-landscape.csv
Type Sample
Small file
679 B
SHA-256 3bf660b0d93762473747cbdf41c7721f9700abaa589461d0bcd4323a048fcdec
Download
Data

Starry Sky CSV

Starry Sky CSV is a Comma-Separated Values sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

06-starry-sky.csv
Type Sample
Small file
705 B
SHA-256 ae74b42ec074812ec903967974fe7e411cbb2f18154f477727f570a0c41393f2
Download
Data

Blue Night Sky CSV

Blue Night Sky CSV is a Comma-Separated Values sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

07-blue-night-sky.csv
Type Sample
Small file
774 B
SHA-256 281a26f3126fbcaa8b310622107ae46290689eb1065431cc301d7265a34d7523
Download
Data

Hibiscus Flower CSV

Hibiscus Flower CSV is a Comma-Separated Values sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

08-hibiscus-flower.csv
Type Sample
1.1 KB
SHA-256 895cd4d9e139546d63cb8e7607c65afd0d5f0cf240b3c237747fa32a5da5c472
Download
Data

Arctic Sky CSV

Arctic Sky CSV is a Comma-Separated Values sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

09-arctic-sky.csv
Type Sample
1.0 KB
SHA-256 7de222dee3046df0502bfa7e9cbf40458ca1753eba204ca7be66a7f0044f2969
Download
Data

NASA Blue Marble CSV

NASA Blue Marble CSV is a Comma-Separated Values 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.csv
Type Sample
1.8 KB
SHA-256 ad9051e1e7e8aa2231b706e740a421d39b158c8900c604a0fd293d52e103af92
Download

よくある質問

Comma-Separated Values のマジックナンバー(ファイルシグネチャ)は?

Comma-Separated Values ファイルはバイトシグネチャ 6E 61 6D 65 ("name") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。

Comma-Separated Values のMIMEタイプは?

Comma-Separated Values のMIMEタイプは text/csv です。

Comma-Separated Values の拡張子は?

Comma-Separated Values ファイルは .csv 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。

関連フォーマット