[36] [DFN[ZIP]] は、広く用いられている[[書庫形式]]の一種です。

[37] 
[[Windows]]、[[Java]] などで採用され、[[書庫形式]]の[[事実上の標準]]となっています。


* 仕様書

[REFS[

- [66] 
[TIME[2022-11-01T17:34:41.000Z]], [TIME[2025-05-11T13:11:44.590Z]] <https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT>
- [15] [CITE[MIME Sniffing Standard]] ([TIME[2016-03-05 01:29:10 +09:00]] 版) <https://mimesniff.spec.whatwg.org/#zip-based-type>
]REFS]

* ファイル形式

[FIG(short list)[ [45] [[ZIPファイル]]

- [[ファイル名の文字コード]]
- [[ファイルの時刻]]
- [[ZIPファイルの署名]]
- [CODE[META-INF/]]
- [CODE[__MACOSX/]]

]FIG]


[50] [[Open Packaging]] ([[OOXML]]) は [[ZIP]] 仕様で曖昧な部分を [[Open Packaging]]
における規定として明確化しています。 [SRC[>>49]]

[49] [CITE@ja[ECMA-376-new-merged.pdf]], [TIME[2007-02-09T03:33:59.000Z]], [TIME[2024-06-04T14:04:20.573Z]] <http://web.mit.edu/~stevenj/www/ECMA-376-new-merged.pdf#page=255>

** extra field

- [56] 
[CITE@en[zipdetails/bin/zipdetails at main · pmqs/zipdetails · GitHub]], [TIME[2025-05-25T06:24:01.000Z]] <https://github.com/pmqs/zipdetails/blob/main/bin/zipdetails>
- [52] [CITE[ZipArchive: Unicode Support: Using Non-English Characters in Filenames, Comments and Passwords]], [TIME[2025-05-25T06:18:44.000Z]] <https://www.artpol-software.com/ZipArchive/KB/0610051525.aspx#customExtra>
- [55] 
[CITE@en[Xceed zip extra fields]], [TIME[2025-05-25T06:23:11.000Z]] <https://support.xceed.com/portal/en/community/topic/xceed-zip-extra-fields>




[SEE[ [[ファイル名の文字コード]] ]]

** ファイル名

[SEE[ [[ファイル名の文字コード]] ]]



-[59] 
[CITE@en[ZIP extraction containing backwards slashes \ in path names · Issue #1502 · aonez/Keka]], [TIME[2025-11-22T13:54:06.000Z]] <https://github.com/aonez/Keka/issues/1502>



** 注釈

[68] [[ZIP]] 全体の[[注釈]]と各[[ファイル]]の[[注釈]]があります。

[69] [[ファイル名]]と同様に[[文字コード]]の問題があります。
[SEE[ [[ファイル名の文字コード]] ]]

-
[65] 
[CITE@en-us[zip_file_set_comment · libzip]], [TIME[2025-05-23T14:03:22.000Z]], [TIME[2025-12-30T08:11:02.076Z]] <https://libzip.org/documentation/zip_file_set_comment.html>
-
[62] 
[CITE@en[utf 8 - What encoding to use for Zip archive comments? - Stack Overflow]], [TIME[2025-12-30T08:07:25.000Z]] <https://stackoverflow.com/questions/16804134/what-encoding-to-use-for-zip-archive-comments>
- [64] 
[CITE@en[encoding - Cannot set encoded comment for zip archive using sharpZipLib - Stack Overflow]], [TIME[2025-12-30T08:10:05.000Z]] <https://stackoverflow.com/questions/77963359/cannot-set-encoded-comment-for-zip-archive-using-sharpziplib>
-[63] 
[CITE[zipdetails - display the internal structure of zip files]], [TIME[2025-12-30T08:08:08.000Z]] <https://docs.mojolicious.org/zipdetails#Filenames-Comments>
- [67] 
[CITE@ja[PHP: ZipArchive::setArchiveComment - Manual]], [TIME[2025-12-30T06:18:02.000Z]], [TIME[2025-12-30T08:12:10.702Z]] <https://www.php.net/manual/ja/ziparchive.setarchivecomment.php>


* MIME 型

[33] [DFN[[RUBYB[ZIPを基にした型]@en[ZIP-based type]]]]は、
次のいずれかを満たすものです [SRC[>>15]]。
[FIG(list)[
- [34] [[構文解析可能MIME型]]であって、[F[部分型]]が [CODE[+zip]] で終わるもの
- [35] [[構文解析可能MIME型]]であって、[F[MIME型部分]]が 
[CODE(MIME)@en[application/zip]] であるもの
]FIG]

[77] 
その他のもの:

- [DFN[[CODE[application/x-zip-compressed]]]]
- [DFN[[CODE[application/x-zip]]]]

;; [46] [[JSON]] 形式の一覧データファイルがあります。
[REFS[
- [47] [CITE@en[data-web-defs/mime-types.txt at master · manakai/data-web-defs]] ([TIME[2016-04-06 21:39:51 +09:00]] 版) <https://github.com/manakai/data-web-defs/blob/master/doc/mime-types.txt>
-- [48] ドキュメント: [CITE@en[data-web-defs/mime-types.json at master · manakai/data-web-defs]] ([TIME[2016-04-06 21:39:29 +09:00]] 版) <https://github.com/manakai/data-web-defs/blob/master/data/mime-types.json>
]REFS]

[82] 
特定の [[ZIP]] に基づく形式のもの:

- [CODE[[VAR[*]]/[VAR[*]]+zip]]
- [CODE[application/java-archive]]
- [CODE[application/vnd.openxmlformats-officedocument.wordprocessingml.document]]
- [CODE[application/vnd.openxmlformats-officedocument.presentationml.presentation]]
- [CODE[application/vnd.openxmlformats-officedocument.spreadsheetml.sheet]]
- [CODE[application/vnd.oasis.opendocument.presentation]]
- [CODE[application/vnd.oasis.opendocument.spreadsheet]]
- [CODE[application/vnd.oasis.opendocument.text]]
- [CODE[application/x-xpinstall]]
- [CODE[application/widget]]




[53] [CITE@el[Διακηρύξεις μίσθωσης και εκμίσθωσης ακινήτων. - Διεύθυνση Διοικητικών Υπηρεσιών - Ελληνική Δημοκρατία - Περιφέρεια Αττικής]], [TIME[2025-05-23T15:08:16.000Z]] <https://opendata.attica.gov.gr/content/genikh-dieythynsh-eswterikhs-leitoyrgias/d-nsh-dioikhtikwn-yphresiwn/155-diakhrykseis?preview=263-diakhrykseis-2020-zip>


[54] >>53 なぜか

>
,Mime type ,	application/vnd.rar

となっているが実際のファイルの [[HTTP]] [CODE[Content-Type]] は [CODE[application/zip]]。
ファイルそのものも[[ZIP]]。



* [CODE(URI)@en[zip:]] URL scheme

[16] 構文: [CODE[zip:// zip-file-uri[! absolute-path] ]]

[17] 例:
-[SAMP(URI)[zip:http://somehost/downloads/somefile.zip]]
-[SAMP(URI)[jar:zip:outer.zip!/nested.jar!/somedir]]
-[SAMP(URI)[jar:zip:outer.zip!/nested.jar!/some%21dir]] 

[18] [CITE[Commons VFS - Supported File Systems]] <http://jakarta.apache.org/commons/sandbox/vfs/filesystems.html#Zip%20and%20Jar>

* 応用

[14] 
[FIG(list short)[
- [[JAR]]
- [[XPI]]
- [CODE[.crx]]
- [[Widgets]]
- [[OCF]]
- [[Open Document Format]]
- [[Open Packaging Conventions]]
- [[APK]]
- [[ASiC]]

]FIG]

** ZIP ファイルそのものの処理に関する規定を持つもの

[78] 
[CITE[Packaged Web Apps (Widgets) - Packaging and XML Configuration (Second Edition)]], [TIME[2016-08-18T15:34:32.000Z]], [TIME[2026-01-04T02:29:06.066Z]] <https://w3c.github.io/packaged-webapps/packaging/#steps-for-processing-a-widget-package>


[79] [CITE@en-US[ECMA-376 - Ecma International]], [TIME[2026-01-04T02:47:38.000Z]] <https://ecma-international.org/publications-and-standards/standards/ecma-376/>
part 2


[80] 
[CITE@en-US[EPUB 3.4]], [TIME[2025-12-21T10:14:03.000Z]], [TIME[2026-01-04T03:04:04.753Z]] <https://w3c.github.io/epub-specs/epub34/authoring/#sec-container-zip>

[81] 
[CITE@en-US[Open Document Format for Office Applications (OpenDocument) Version 1.4. Part 2: Packages]], [TIME[2025-10-06T17:00:00.000Z]], [TIME[2026-01-04T03:09:16.093Z]] <https://docs.oasis-open.org/office/OpenDocument/os/part2-packages/OpenDocument-v1.4-os-part2-packages.html>


* zipでくれ

[44] [CITE[俺の彼女と幼なじみが修羅場すぎる 全13話一挙放送 - 2023/6/14(水) 19:00開始 - ニコニコ生放送]]
([TIME[2023-06-19 11:06:22 +09:00]])
<https://live.nicovideo.jp/watch/lv341136348>

* 実利用例


[SEE[ ファイル名に関して興味深いものは[[ファイル名の文字コード]] ]]

- [57] [CITE@en-US[Download and installation help - CNET Download]], [TIME[2025-11-03T07:39:22.000Z]] <https://download.cnet.com/support/shakti-office-english-hindi/3000-2079_4-10803367.html>
-- [58] [CITE[Explzh]] では圧縮ファイルではないとして開けないファイル。
[[Windows Explorer]] では開ける。
- [60] [TIME[2025-12-30T08:01:59.700Z]]
<https://zenpo-huchui.com/download/starchaser_win.zip>
-- [61] ファイル全体の注釈に生成ソフトウェア情報が入っている。 [[ASCII]]。
- [75] 
[TIME[2026-01-01T07:50:29.600Z]]
<https://git.zx2c4.com/linux-dev/snapshot/linux-dev-cd83f6b194e95fa616dd3157ae7a63d4713b6670.zip>
-- [76] 
[CODE[Content-Type]]
が
[CODE[application/x-zip; charset=UTF-8]]



* 人工的な利用例

- [70] [CITE@en[rubyzip/test/data at main · rubyzip/rubyzip · GitHub]], [TIME[2025-12-31T09:30:56.000Z]] <https://github.com/rubyzip/rubyzip/tree/main/test/data>
-- [71] 
[TIME[2026-01-01T00:55:16.700Z]]
<https://raw.githubusercontent.com/rubyzip/rubyzip/refs/heads/main/test/data/max_length_file_comment.zip>
--- [72] [[Perlモジュール]] [CODE[Archive::Zip]] ではエラーになって開けません。
[TIME[2026-01-01T00:55:38.00Z]]
--- [73] [CITE[Explzh]] では開けます。 [TIME[2026-01-01T00:55:46.300Z]]
- [74] 
[CITE@en[GitHub - tuzovakaoff/zip_path_traversal: Path traversal with zip archive]], [TIME[2026-01-01T00:57:20.000Z]] <https://github.com/tuzovakaoff/zip_path_traversal>

* 歴史

[1] [CITE@en-gb[Application Note Archives - PKWARE, Inc.]] ([[Justin Nichols]] 著, [TIME[2008-11-30 18:37:52 +09:00]] 版) <http://www.pkware.com/support/application-note-archives>

[51] 
[CITE@ja[Microsoft Word - A-100-5.doc - a_100_5.pdf]], [TIME[2024-08-30T08:17:33.000Z]] <https://web.archive.org/web/20060927005504/http://www.atsc.org/standards/a_100_5.pdf>

[2] [CITE@en-US[Data.driven() » Widgets 1.0]] ([TIME[2008-11-30 18:37:15 +09:00]] 版) <http://datadriven.com.au/tag/widgets-10/>

[3] [CITE@en-US[Zip files and Encoding - I hate you. | Data.driven()]] ([TIME[2009-07-05 11:55:12 +09:00]] 版) <http://datadriven.com.au/2008/12/08/zip-files-and-encoding-i-hate-you/>

[4] [CITE@en['''['''dsdl-discuss''']''' Basic ZIP format is "public domain" from rjelliffe_at_allette.com.au on 2010-03-26 (dsdl-discuss.2010-03)]]
([[rjelliffe_at_allette.com.au (rjelliffe_at_allette.com.au)]] 著, [TIME[2010-03-27 00:03:02 +09:00]] 版)
<http://lists.dsdl.org/dsdl-discuss/2010-03/0024.html>

[5] [CITE@ja[ZIP (ファイルフォーマット) - Wikipedia]]
( ([TIME[2012-11-16 23:51:31 +09:00]] 版))
<http://ja.wikipedia.org/wiki/ZIP_(%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%88)>

[6] [CITE@en[Zip - WHATWG Wiki]]
( ([TIME[2013-08-31 03:47:21 +09:00]] 版))
<http://wiki.whatwg.org/wiki/Zip>

[7] ( ([TIME[2012-11-08 06:46:45 +09:00]] 版))
<http://www.itscj.ipsj.or.jp/sc34/open/1855.pdf>

[8] [CITE@en[RFC 6839 - Additional Media Type Structured Syntax Suffixes]]
( ([TIME[2013-06-28 00:23:48 +09:00]] 版))
<http://tools.ietf.org/html/rfc6839#section-3.6>

[9] [CITE[OASIS Open Document Format for Office Applications (OpenDocument) Version 1.2 - Part 3: Packages]]
([TIME[2011-09-29 13:00:00 +09:00]] 版)
<http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part3.html#a2_2_1OpenDocument_Package>

[10] ([TIME[2014-04-08 22:35:48 +09:00]] 版)
<https://www.khronos.org/files/collada_spec_1_5.pdf>

[FIG(quote)[
[FIGCAPTION[
[11] ([TIME[2011-07-16 05:29:35 +09:00]] 版)
<https://www.iana.org/assignments/media-types/application/zip>
]FIGCAPTION]

> This filetype is not recommended for normal use, since Content-Type
> information for the files contained within the archive are not known.
> Instead multipart/mixed should be used and each file should have it's
> own Content-Type.

]FIG]


[12] [CITE[Packaged Web Apps (Widgets) - Packaging and XML Configuration (Second Edition)]]
([TIME[2015-01-27 11:24:04 +09:00]] 版)
<http://w3c.github.io/packaged-webapps/packaging/>

[13] [CITE@en[RFC 6839 - Additional Media Type Structured Syntax Suffixes]] ([TIME[2013-06-28 00:23:48 +09:00]] 版) <http://tools.ietf.org/html/rfc6839#section-3.6>

[19] [CITE[IRC logs: freenode / #whatwg / 20131006]]
( ([TIME[2013-10-11 20:32:09 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20131006#l-537>

[20] [CITE[Remove zip archives (for now). · e5c1f60 · whatwg/fetch]]
( ([TIME[2013-10-30 06:19:44 +09:00]] 版))
<https://github.com/whatwg/fetch/commit/e5c1f60bce08f571b3da946560eeb3012776ab87>

[21] [CITE[packages.md]]
( ([TIME[2014-01-08 11:35:46 +09:00]] 版))
<https://gist.github.com/wycats/220039304b053b3eedd0>

[22] [CITE[IRC logs: freenode / #whatwg / 20140106]]
( ([TIME[2014-01-07 23:19:33 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20140106#l-347>

[23] [CITE@en[''''''[''''''dsdl-discuss'''''']'''''' Re: ISO/IEC 21320-1 - CD ballot from Jirka Kosek on 2013-09-13 (dsdl-discuss.2013-09)]]
( ([[Jirka Kosek (jirka_at_kosek.cz)]] 著, [TIME[2013-09-15 08:33:01 +09:00]] 版))
<http://lists.dsdl.org/dsdl-discuss/2013-09/0000.html>

[24] [CITE@en[Generic syntax]]
( ([[Anne van Kesteren]] 著, [TIME[2013-08-27 23:15:22 +09:00]] 版))
<http://lists.w3.org/Archives/Public/public-media-fragment/2013Aug/0001.html>

[25] [CITE@en[64286 – web archive save/view support (KDE/Konqueror-like .war, .zip, .tgz, .tar.gz, .tar.bz2, tb2, .tbz2, .jar)]]
([TIME[2015-05-07 23:03:12 +09:00]] 版)
<https://bugzilla.mozilla.org/show_bug.cgi?id=64286>

[26] [CITE[zip URLs]]
( ([TIME[2013-08-26 12:08:58 +09:00]] 版))
<https://gist.github.com/annevk/6174119>

[27] [CITE[''''''[''''''whatwg'''''']'''''' Zip archives as first-class citizens]]
( ([TIME[2013-08-28 13:32:53 +09:00]] 版))
<http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-August/040599.html>

[28] [CITE@en[MoPad: zipurls]]
( ([TIME[2013-08-29 14:06:47 +09:00]] 版))
<https://etherpad.mozilla.org/zipurls>

[29] [CITE[IRC logs: freenode / #whatwg / 20130823]]
( ([TIME[2013-08-26 12:15:51 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20130823#l-719>

[30] [CITE[IRC logs: freenode / #whatwg / 20130829]]
( ([TIME[2013-09-05 09:02:52 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20130829>

[31] [CITE@en[URL format for linking to resources inside ZIP files · Issue #137 · dataprotocols/dataprotocols]]
([TIME[2015-06-25 15:43:43 +09:00]] 版)
<https://github.com/dataprotocols/dataprotocols/issues/137>

[32] [CITE[技術/歴史/zip,gzip,zlib,bzip2 - Glamenv-Septzen.net]]
([TIME[2016-02-04 22:31:03 +09:00]] 版)
<http://www.glamenv-septzen.net/view/495>

[38] [CITE@en[Define a new MIME type model, parser, and serializer]]
([[annevk]]著, [TIME[2017-12-07 22:11:12 +09:00]])
<https://github.com/whatwg/mimesniff/commit/cc81ec48288944562c4554069da1d74a71e199fb>

[39] [CITE@en[Editorial: tweak MIME type group definitions]]
([[domenic]]著, [TIME[2018-02-06 06:35:09 +09:00]])
<https://github.com/whatwg/mimesniff/commit/452938939d1d88e3c74f59f41f14579249130437>

[40] [CITE@en[Editorial: tweak MIME type group definitions by domenic · Pull Request #59 · whatwg/mimesniff]]
([TIME[2018-02-17 18:28:01 +09:00]])
<https://github.com/whatwg/mimesniff/pull/59>

[41] [CITE@en[IETF HTML5 Meeting March 2009 - W3C Wiki]]
([TIME[2018-04-21 13:28:11 +09:00]])
<https://www.w3.org/wiki/IETF_HTML5_Meeting_March_2009>

[42] [CITE@ja[zipファイルをお送り頂いた場合の手数料について | 株式会社サムライズム]]
(2020年4月1日 に yusuke が投稿 [TIME[2020-04-03 13:08:22 +09:00]])
<https://samuraism.com/2020/04/01/11319>

[43] [CITE@ja[霞が関でパスワード付きzipファイルを廃止へ 平井デジタル相 - ITmedia NEWS]]
([TIME[2020-11-19T02:05:06.000Z]])
<https://www.itmedia.co.jp/news/articles/2011/17/news150.html>


