init
This commit is contained in:
commit
c5cd492449
475 changed files with 27928 additions and 0 deletions
140
technology/files/ASCII.md
Normal file
140
technology/files/ASCII.md
Normal file
|
@ -0,0 +1,140 @@
|
|||
---
|
||||
obj: concept
|
||||
wiki: https://en.wikipedia.org/wiki/ASCII
|
||||
---
|
||||
|
||||
# **American Standard Code for Information Interchange** (ASCII)
|
||||
|
||||
ASCII abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices ([Binary](../../science/math/Binary%20System.md) to Text). Because of technical limitations of computer systems at the time it was invented, ASCII has just 128 code points, of which only 95 are printable characters, which severely limited its scope. Modern computer systems have evolved to use Unicode, which has millions of code points, but the first 128 of these are the same as the ASCII set.
|
||||
|
||||
## ASCII Table
|
||||
| Dec | Hex | Oct | ASCII |
|
||||
| --- | --- | --- | ------- |
|
||||
| 0 | 00 | 000 | `NUL` |
|
||||
| 1 | 01 | 001 | `SOH` |
|
||||
| 2 | 02 | 002 | `STX` |
|
||||
| 3 | 03 | 003 | `ETX` |
|
||||
| 4 | 04 | 004 | `EOT` |
|
||||
| 5 | 05 | 005 | `ENQ` |
|
||||
| 6 | 06 | 006 | `ACK` |
|
||||
| 7 | 07 | 007 | `BEL` |
|
||||
| 8 | 08 | 010 | `BS` |
|
||||
| 9 | 09 | 011 | `HT` |
|
||||
| 10 | 0A | 012 | `LF` |
|
||||
| 11 | 0B | 013 | `VT` |
|
||||
| 12 | 0C | 014 | `FF` |
|
||||
| 13 | 0D | 015 | `CR` |
|
||||
| 14 | 0E | 016 | `SO` |
|
||||
| 15 | 0F | 017 | `SI` |
|
||||
| 16 | 10 | 020 | `DLE` |
|
||||
| 17 | 11 | 021 | `DC1` |
|
||||
| 18 | 12 | 022 | `DC2` |
|
||||
| 19 | 13 | 023 | `DC3` |
|
||||
| 20 | 14 | 024 | `DC4` |
|
||||
| 21 | 15 | 025 | `NAK` |
|
||||
| 22 | 16 | 026 | `SYN` |
|
||||
| 23 | 17 | 027 | `ETB` |
|
||||
| 24 | 18 | 030 | `CAN` |
|
||||
| 25 | 19 | 031 | `EM` |
|
||||
| 26 | 1A | 032 | `SUB` |
|
||||
| 27 | 1B | 033 | `ESC` |
|
||||
| 28 | 1C | 034 | `FS` |
|
||||
| 29 | 1D | 035 | `GS` |
|
||||
| 30 | 1E | 036 | `RS` |
|
||||
| 31 | 1F | 037 | `US` |
|
||||
| 32 | 20 | 040 | `SP` |
|
||||
| 33 | 21 | 041 | `!` |
|
||||
| 34 | 22 | 042 | `"` |
|
||||
| 35 | 23 | 043 | `#` |
|
||||
| 36 | 24 | 044 | `$` |
|
||||
| 37 | 25 | 045 | `%` |
|
||||
| 38 | 26 | 046 | `&` |
|
||||
| 39 | 27 | 047 | `'` |
|
||||
| 40 | 28 | 050 | `(` |
|
||||
| 41 | 29 | 051 | `)` |
|
||||
| 42 | 2A | 052 | `*` |
|
||||
| 43 | 2B | 053 | `+` |
|
||||
| 44 | 2C | 054 | `,` |
|
||||
| 45 | 2D | 055 | `-` |
|
||||
| 46 | 2E | 056 | `.` |
|
||||
| 47 | 2F | 057 | `/` |
|
||||
| 48 | 30 | 060 | `0` |
|
||||
| 49 | 31 | 061 | `1` |
|
||||
| 50 | 32 | 062 | `2` |
|
||||
| 51 | 33 | 063 | `3` |
|
||||
| 52 | 34 | 064 | `4` |
|
||||
| 53 | 35 | 065 | `5` |
|
||||
| 54 | 36 | 066 | `6` |
|
||||
| 55 | 37 | 067 | `7` |
|
||||
| 56 | 38 | 070 | `8` |
|
||||
| 57 | 39 | 071 | `9` |
|
||||
| 58 | 3A | 072 | `:` |
|
||||
| 59 | 3B | 073 | `;` |
|
||||
| 60 | 3C | 074 | `<` |
|
||||
| 61 | 3D | 075 | `=` |
|
||||
| 62 | 3E | 076 | `>` |
|
||||
| 63 | 3F | 077 | `?` |
|
||||
| 64 | 40 | 100 | `@` |
|
||||
| 65 | 41 | 101 | `A` |
|
||||
| 66 | 42 | 102 | `B` |
|
||||
| 67 | 43 | 103 | `C` |
|
||||
| 68 | 44 | 104 | `D` |
|
||||
| 69 | 45 | 105 | `E` |
|
||||
| 70 | 46 | 106 | `F` |
|
||||
| 71 | 47 | 107 | `G` |
|
||||
| 72 | 48 | 110 | `H` |
|
||||
| 73 | 49 | 111 | `I` |
|
||||
| 74 | 4A | 112 | `J` |
|
||||
| 75 | 4B | 113 | `K` |
|
||||
| 76 | 4C | 114 | `L` |
|
||||
| 77 | 4D | 115 | `M` |
|
||||
| 78 | 4E | 116 | `N` |
|
||||
| 79 | 4F | 117 | `O` |
|
||||
| 80 | 50 | 120 | `P` |
|
||||
| 81 | 51 | 121 | `Q` |
|
||||
| 82 | 52 | 122 | `R` |
|
||||
| 83 | 53 | 123 | `S` |
|
||||
| 84 | 54 | 124 | `T` |
|
||||
| 85 | 55 | 125 | `U` |
|
||||
| 86 | 56 | 126 | `V` |
|
||||
| 87 | 57 | 127 | `W` |
|
||||
| 88 | 58 | 130 | `X` |
|
||||
| 89 | 59 | 131 | `Y` |
|
||||
| 90 | 5A | 132 | `Z` |
|
||||
| 91 | 5B | 133 | `[` |
|
||||
| 92 | 5C | 134 | `\` |
|
||||
| 93 | 5D | 135 | `]` |
|
||||
| 94 | 5E | 136 | `^` |
|
||||
| 95 | 5F | 137 | `_` |
|
||||
| 96 | 60 | 140 | `` ` `` |
|
||||
| 97 | 61 | 141 | `a` |
|
||||
| 98 | 62 | 142 | `b` |
|
||||
| 99 | 63 | 143 | `c` |
|
||||
| 100 | 64 | 144 | `d` |
|
||||
| 101 | 65 | 145 | `e` |
|
||||
| 102 | 66 | 146 | `f` |
|
||||
| 103 | 67 | 147 | `g` |
|
||||
| 104 | 68 | 150 | `h` |
|
||||
| 105 | 69 | 151 | `i` |
|
||||
| 106 | 6A | 152 | `j` |
|
||||
| 107 | 6B | 153 | `k` |
|
||||
| 108 | 6C | 154 | `l` |
|
||||
| 109 | 6D | 155 | `m` |
|
||||
| 110 | 6E | 156 | `n` |
|
||||
| 111 | 6F | 157 | `o` |
|
||||
| 112 | 70 | 160 | `p` |
|
||||
| 113 | 71 | 161 | `q` |
|
||||
| 114 | 72 | 162 | `r` |
|
||||
| 115 | 73 | 163 | `s` |
|
||||
| 116 | 74 | 164 | `t` |
|
||||
| 117 | 75 | 165 | `u` |
|
||||
| 118 | 76 | 166 | `v` |
|
||||
| 119 | 77 | 167 | `w` |
|
||||
| 120 | 78 | 170 | `x` |
|
||||
| 121 | 79 | 171 | `y` |
|
||||
| 122 | 7A | 172 | `z` |
|
||||
| 123 | 7B | 173 | `{` |
|
||||
| 124 | 7C | 174 | `\|` |
|
||||
| 125 | 7D | 175 | `}` |
|
||||
| 126 | 7E | 176 | `~` |
|
||||
| 127 | 7F | 177 | `DEL` |
|
14
technology/files/BSON.md
Normal file
14
technology/files/BSON.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
obj: concept
|
||||
website: https://bsonspec.org
|
||||
wiki: https://en.wikipedia.org/wiki/BSON
|
||||
---
|
||||
|
||||
# BSON
|
||||
BSON, short for Binary [JSON](JSON.md), is a binary-encoded serialization of [JSON](JSON.md)-like documents. Like [JSON](JSON.md), BSON supports the embedding of documents and arrays within other documents and arrays. BSON also contains extensions that allow representation of data types that are not part of the [JSON](JSON.md) spec. For example, BSON has a Date type and a BinData type. [MongoDB](../applications/MongoDB.md) uses BSON internally for storing the database.
|
||||
|
||||
BSON was designed to have the following three characteristics:
|
||||
- Lightweight: Keeping spatial overhead to a minimum is important for any data representation format, especially when used over the network.
|
||||
- Traversable: BSON is designed to be traversed easily. This is a vital property in its role as the primary data representation for MongoDB.
|
||||
- Efficient: Encoding data to BSON and decoding from BSON can be performed very quickly in most languages due to the use of C data types.
|
||||
|
89
technology/files/Base64.md
Normal file
89
technology/files/Base64.md
Normal file
|
@ -0,0 +1,89 @@
|
|||
---
|
||||
obj: concept
|
||||
wiki: https://en.wikipedia.org/wiki/Base64
|
||||
rfc: https://datatracker.ietf.org/doc/html/rfc4648
|
||||
---
|
||||
|
||||
# Base64
|
||||
Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an [ASCII](ASCII.md) string format by translating it into a radix-64 representation.
|
||||
|
||||
When the term "Base64" is used on its own to refer to a specific algorithm, it typically refers to the version of Base64 outlined in RFC 4648, section 4, which uses the following alphabet to represent the radix-64 digits, alongside = as a padding character:
|
||||
```
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
|
||||
```
|
||||
|
||||
A common variant is "Base64 URL safe", which omits the padding and replaces `+/` with `-_` to avoid characters that might cause problems in [URL](../internet/URL.md) path segments or query parameters.
|
||||
|
||||
Base64 encoding schemes are commonly used to encode binary data for storage or transfer over media that can only deal with [ASCII](ASCII.md) text (or some superset of [ASCII](ASCII.md) that still falls short of accepting arbitrary binary data). This ensures that the data remains intact without modification during transport. Common applications of Base64 include:
|
||||
- [Email](../internet/eMail.md) via [MIME](MIME.md)
|
||||
- Storing complex data in [XML](XML.md)
|
||||
- Encoding binary data so it can be included in a [Data URL](../internet/Data%20URLs.md)
|
||||
|
||||
## Alphabet
|
||||
| Index | Binary | Char |
|
||||
| ------- | ------ | ---- |
|
||||
| 0 | 000000 | `A` |
|
||||
| 1 | 000001 | `B` |
|
||||
| 2 | 000010 | `C` |
|
||||
| 3 | 000011 | `D` |
|
||||
| 4 | 000100 | `E` |
|
||||
| 5 | 000101 | `F` |
|
||||
| 6 | 000110 | `G` |
|
||||
| 7 | 000111 | `H` |
|
||||
| 8 | 001000 | `I` |
|
||||
| 9 | 001001 | `J` |
|
||||
| 10 | 001010 | `K` |
|
||||
| 11 | 001011 | `L` |
|
||||
| 12 | 001100 | `M` |
|
||||
| 13 | 001101 | `N` |
|
||||
| 14 | 001110 | `O` |
|
||||
| 15 | 001111 | `P` |
|
||||
| 16 | 010000 | `Q` |
|
||||
| 17 | 010001 | `R` |
|
||||
| 18 | 010010 | `S` |
|
||||
| 19 | 010011 | `T` |
|
||||
| 20 | 010100 | `U` |
|
||||
| 21 | 010101 | `V` |
|
||||
| 22 | 010110 | `W` |
|
||||
| 23 | 010111 | `X` |
|
||||
| 24 | 011000 | `Y` |
|
||||
| 25 | 011001 | `Z` |
|
||||
| 26 | 011010 | `a` |
|
||||
| 27 | 011011 | `b` |
|
||||
| 28 | 011100 | `c` |
|
||||
| 29 | 011101 | `d` |
|
||||
| 30 | 011110 | `e` |
|
||||
| 31 | 011111 | `f` |
|
||||
| 32 | 100000 | `g` |
|
||||
| 33 | 100001 | `h` |
|
||||
| 34 | 100010 | `i` |
|
||||
| 35 | 100011 | `j` |
|
||||
| 36 | 100100 | `k` |
|
||||
| 37 | 100101 | `l` |
|
||||
| 38 | 100110 | `m` |
|
||||
| 39 | 100111 | `n` |
|
||||
| 40 | 101000 | `o` |
|
||||
| 41 | 101001 | `p` |
|
||||
| 42 | 101010 | `q` |
|
||||
| 43 | 101011 | `r` |
|
||||
| 44 | 101100 | `s` |
|
||||
| 45 | 101101 | `t` |
|
||||
| 46 | 101110 | `u` |
|
||||
| 47 | 101111 | `v` |
|
||||
| 48 | 110000 | `w` |
|
||||
| 49 | 110001 | `x` |
|
||||
| 50 | 110010 | `y` |
|
||||
| 51 | 110011 | `z` |
|
||||
| 52 | 110100 | `0` |
|
||||
| 53 | 110101 | `1` |
|
||||
| 54 | 110110 | `2` |
|
||||
| 55 | 110111 | `3` |
|
||||
| 56 | 111000 | `4` |
|
||||
| 57 | 111001 | `5` |
|
||||
| 58 | 111010 | `6` |
|
||||
| 59 | 111011 | `7` |
|
||||
| 60 | 111100 | `8` |
|
||||
| 61 | 111101 | `9` |
|
||||
| 62 | 111110 | `+` |
|
||||
| 63 | 111111 | `/` |
|
||||
| Padding | - | = |
|
17
technology/files/CSV.md
Normal file
17
technology/files/CSV.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
wiki: https://en.wikipedia.org/wiki/Comma-separated_values
|
||||
rfc: https://datatracker.ietf.org/doc/html/rfc4180
|
||||
obj: concept
|
||||
---
|
||||
# CSV
|
||||
|
||||
Comma-separated values (CSV) is a text file format that uses commas to separate values. A CSV file stores tabular data (numbers and text) in plain text, where each line of the file typically represents one data record. Each record consists of the same number of fields, and these are separated by commas in the CSV file. If the field delimiter itself may appear within a field, fields can be surrounded with quotation marks.
|
||||
|
||||
# Example
|
||||
```csv
|
||||
Year,Make,Model
|
||||
1997,Ford,E350
|
||||
2000,Mercury,Cougar
|
||||
```
|
||||
|
||||
|
16
technology/files/Comic Book Archive.md
Normal file
16
technology/files/Comic Book Archive.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
obj: concept
|
||||
wiki: https://en.wikipedia.org/wiki/Comic_book_archive
|
||||
---
|
||||
|
||||
# Comic Book Archive
|
||||
A comic book archive is a type of archive file for the purpose of sequential viewing of images, commonly for comic books or manga.
|
||||
|
||||
The filename extension indicates the archive type used:
|
||||
- `.cb7` → [7z](../applications/cli/p7zip.md)
|
||||
- `.cba` → ACE
|
||||
- `.cbr` → RAR
|
||||
- `.cbt` → [TAR](../applications/cli/tar.md)
|
||||
- `.cbz` → [ZIP](ZIP.md)
|
||||
|
||||
Comic book archive files mainly consist of a series of image files with specific naming, typically [PNG](../media/image/PNG.md) (lossless compression) or JPEG (lossy compression, not JPEG-LS or JPEG XT) files, stored as a single archive file. Occasionally GIF, BMP, and TIFF files are seen. Folders may be used to group images in a more logical layout within the archive, like book chapters.
|
55
technology/files/Desktop Entry.md
Normal file
55
technology/files/Desktop Entry.md
Normal file
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
arch-wiki: https://wiki.archlinux.org/title/desktop_entries
|
||||
obj: concept
|
||||
---
|
||||
# Desktop Entry
|
||||
The [XDG Desktop Entry specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) defines a standard for applications to integrate into application menus of desktop environments implementing the [XDG Desktop Menu](https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html) specification.
|
||||
|
||||
## Basics
|
||||
Each desktop entry must have a `Type` and a `Name` key and can optionally define its appearance in the application menu.
|
||||
|
||||
The three available types are:
|
||||
### Application
|
||||
Defines how to launch an application and what MIME types it supports (used by XDG MIME Applications. With XDG Autostart Application entries can be started automatically by placing them in specific directories. Application entries use the `.desktop` file extension.
|
||||
|
||||
### Link
|
||||
Defines a shortcut to a `URL`. Link entries use the `.desktop` file extension.
|
||||
|
||||
### Directory
|
||||
Defines the appearance of a submenu in the application menu. Directory entries use the `.directory` file extension.
|
||||
|
||||
## Application entry
|
||||
Desktop entries for applications, or `.desktop` files, are generally a combination of meta information resources and a shortcut of an application. These files usually reside in `/usr/share/applications/` or `/usr/local/share/applications/` for applications installed system-wide, or `~/.local/share/applications/` for user-specific applications. User entries take precedence over system entries.
|
||||
|
||||
### File example
|
||||
Following is an example of its structure with additional comments. The example is only meant to give a quick impression, and does not show how to utilize all possible entry keys. The complete list of keys can be found in the [freedesktop specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys).
|
||||
|
||||
```ini
|
||||
[Desktop Entry]
|
||||
# The type as listed above
|
||||
Type=Application
|
||||
|
||||
# The version of the desktop entry specification to which this file complies
|
||||
Version=1.0
|
||||
|
||||
# The name of the application
|
||||
Name=jMemorize
|
||||
|
||||
# A comment which can/will be used as a tooltip
|
||||
Comment=Flash card based learning tool
|
||||
|
||||
# The path to the folder in which the executable is run
|
||||
Path=/opt/jmemorise
|
||||
|
||||
# The executable of the application, possibly with arguments.
|
||||
Exec=jmemorize
|
||||
|
||||
# The name of the icon that will be used to display this entry
|
||||
Icon=jmemorize
|
||||
|
||||
# Describes whether this application needs to be run in a terminal or not
|
||||
Terminal=false
|
||||
|
||||
# Describes the categories in which this entry should be shown
|
||||
Categories=Education;Languages;Java;
|
||||
```
|
59
technology/files/File Formats.md
Normal file
59
technology/files/File Formats.md
Normal file
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
obj: meta/collection
|
||||
---
|
||||
|
||||
# File Formats
|
||||
| Extension | Content |
|
||||
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `.7z` | [7z](../applications/cli/p7zip.md) Archive |
|
||||
| `.apk` | - [Android](../systems/Android.md) package<br>- Package format of the [Alpine Linux](../linux/Alpine%20Linux.md) distribution |
|
||||
| `.exe` | [Windows](../windows/Windows.md) Application |
|
||||
| `.html` | [HTML](../internet/HTML.md) File |
|
||||
| `.png` | [PNG](../media/image/PNG.md) File |
|
||||
| `.webp` | WebP Image |
|
||||
| `.py` | [Python](../programming/languages/Python.md) Code |
|
||||
| `.rar` | RAR Archive |
|
||||
| `.tar` | [TAR](../applications/cli/tar.md) Archive |
|
||||
| `.zip` | [ZIP](ZIP.md) Archive |
|
||||
| `.iso` | DVD Image Format |
|
||||
| `.img` | Raw Disk Image |
|
||||
| `.db`<br>`.sqlite` | [SQLite](../programming/SQLite.md) |
|
||||
| `.sql` | [SQL](../programming/languages/SQL.md) Queries |
|
||||
| `.pdf` | [PDF](PDF.md) File |
|
||||
| `.psd` | Adobe Photoshop |
|
||||
| `.xcf` | XCF File ([Gimp](../applications/media/images/GIMP.md)) |
|
||||
| `.asc` | [ASCII](ASCII.md) Text |
|
||||
| `.docx` | Office Open [XML](XML.md) document |
|
||||
| `.log` | Log File |
|
||||
| `.md` | [Markdown](Markdown.md) File |
|
||||
| `.txt` | Text File |
|
||||
| `.xml` | [XML](XML.md) File |
|
||||
| `.otf` | OpenType Font |
|
||||
| `.ttf` | TrueType Font |
|
||||
| `.woff` | Web Open Font Format |
|
||||
| `.svg` | Scalable Vector Graphics |
|
||||
| `.blend` | [Blender](../applications/3d/Blender.md) File |
|
||||
| `.obj` | Wavefront .obj file |
|
||||
| `.desktop` | Linux [Desktop Entry](Desktop%20Entry.md) |
|
||||
| `.rs` | [Rust](../programming/languages/Rust.md) Code |
|
||||
| `.kdbx` | [KeePass](../applications/utilities/KeePassXC.md) Database |
|
||||
| `.wav` | [Wav](../media/audio/WAV.md) File |
|
||||
| `.flac` | [FLAC](../media/audio/FLAC.md) Audio |
|
||||
| `.xspf` | XML Shareable Playlist Format |
|
||||
| `.m3u` | Playlist File |
|
||||
| `.csv` | [Comma-seperated values](CSV.md) |
|
||||
| `.mkv`<br>`.mka` | [Matroska](../media/Matroska.md) |
|
||||
| `.qcow2` | [QEMU](../linux/qemu.md) copy-on-write – version 2 Qcow |
|
||||
| `.json` | [JSON](JSON.md) File |
|
||||
| `.yaml`<br>`.yml` | [YAML](YAML.md) File |
|
||||
| `.diff` | text file differences created by [diff](../applications/cli/diff.md) and applied as updates by [patch](../applications/cli/patch.md) |
|
||||
| `.part` | Partial File |
|
||||
| `.torrent` | [Torrent](../tools/BitTorrent.md) File |
|
||||
| `.lrc` | LRC (Lyrics) File |
|
||||
| `.nfo` | Information Files |
|
||||
| `.epub` | eBook Format |
|
||||
| `.srt` | SubRip Subtitle |
|
||||
| `.ass` | ASS (Advanced SubStation Alpha) Subtitle |
|
||||
| `.cbz` | [Comic Book Archive](Comic%20Book%20Archive.md). A compressed archive format containing a collection of images or pages that make up a comic book or graphic novel. |
|
||||
| `.eml` | [Email](../internet/eMail.md) Message File |
|
||||
| `.toml` | [TOML](TOML.md) |
|
25
technology/files/JSON Pointer.md
Normal file
25
technology/files/JSON Pointer.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
obj: concept
|
||||
rfc: https://datatracker.ietf.org/doc/html/rfc6901
|
||||
---
|
||||
|
||||
# JSON Pointer
|
||||
JSON Pointer defines a string format for identifying a specific value within a [JSON](JSON.md) document.
|
||||
|
||||
A JSON Pointer is a string of tokens separated by `/` characters, these tokens either specify keys in objects or indexes into arrays. For example, given the [JSON](JSON.md)
|
||||
```json
|
||||
{
|
||||
"biscuits": [
|
||||
{ "name": "Digestive" }`
|
||||
{ "name": "Choco Leibniz" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
`/biscuits` would point to the array of biscuits and `/biscuits/1/name` would point to `"Choco Leibniz"`.
|
||||
|
||||
To point to the root of the document use an empty string for the pointer. The pointer `/` doesn’t point to the root, it points to a key of `""` on the root (which is totally valid in [JSON](../files/JSON.md)).
|
||||
|
||||
If you need to refer to a key with `~` or `/` in its name, you must escape the characters with `~0` and `~1` respectively. For example, to get `"baz"` from `{ "foo/bar~": "baz" }` you’d use the pointer `/foo~1bar~0`.
|
||||
|
||||
Finally, if you need to refer to the end of an array you can use `-` instead of an index. For example, to refer to the end of the array of biscuits above you would use `/biscuits/-`. This is useful when you need to insert a value at the end of an array.
|
36
technology/files/JSON.md
Normal file
36
technology/files/JSON.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
website: https://www.json.org
|
||||
obj: concept
|
||||
---
|
||||
|
||||
# JSON
|
||||
#refactor
|
||||
JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write and easy for machines to parse and generate. It is often used for exchanging data between a web server and a web application, as well as between different programming languages.
|
||||
|
||||
JSON is commonly used in web development to transfer data between a web server and a web application. For example, when a web application makes a request to a web server, the server might respond with a JSON object or array containing the requested data.
|
||||
|
||||
## JSON Syntax
|
||||
|
||||
JSON is built on two structures: objects and arrays. An object is an unordered set of key/value pairs, while an array is an ordered collection of values.
|
||||
|
||||
Here is an example of a JSON object:
|
||||
```json
|
||||
{
|
||||
"name": "John",
|
||||
"age": 30,
|
||||
"city": "New York"
|
||||
}
|
||||
```
|
||||
|
||||
In this example, "name", "age", and "city" are keys, and "John", 30, and "New York" are values. The keys and values are separated by a colon, and each key/value pair is separated by a comma. The entire object is enclosed in curly braces.
|
||||
|
||||
Here is an example of a JSON array:
|
||||
```json
|
||||
[
|
||||
"apple",
|
||||
"banana",
|
||||
"orange"
|
||||
]
|
||||
```
|
||||
|
||||
In this example, "apple", "banana", and "orange" are values. The values are separated by commas, and the entire array is enclosed in square brackets.
|
131
technology/files/MIME.md
Normal file
131
technology/files/MIME.md
Normal file
|
@ -0,0 +1,131 @@
|
|||
---
|
||||
obj: concept
|
||||
---
|
||||
# MIME Type
|
||||
A media type (also known as a MIME type) is a two-part identifier for [file formats](File%20Formats.md) and format contents transmitted on the Internet. The Internet Assigned Numbers Authority (IANA) is the official authority for the standardization and publication of these classifications. Media types were originally defined in Request for Comments RFC 2045 (MIME) Part One: Format of Internet Message Bodies (Nov 1996) in November 1996 as a part of MIME (Multipurpose Internet Mail Extensions) specification, for denoting type of [email](../internet/eMail.md) message content and attachments; hence the original name, MIME type. Media types are also used by other internet protocols such as [HTTP](../internet/HTTP.md) and document [file formats](File%20Formats.md) such as [HTML](../internet/HTML.md), for similar purposes.
|
||||
|
||||
A list of supported MIME Types can be found at `/etc/mime.types`
|
||||
|
||||
## Naming
|
||||
|
||||
A media type consists of a _type_ and a _subtype_, which is further structured into a _tree_. A media type can optionally define a _suffix_ and _parameters_:
|
||||
`type "/" [tree "."] subtype ["+" suffix]* [";" parameter]`
|
||||
As of November 1996, the registered types were: `application`, `audio`, `image`, `message`, `multipart`, `text` and `video`. By December 2020, the registered types included the foregoing, plus `font`, `example`, and `model`.
|
||||
|
||||
An unofficial top-level name in common use is `chemical`.
|
||||
|
||||
As an example, an [HTML](../internet/HTML.md) file might be designated `text/html; charset=UTF-8`. In this example, `text` is the type, `html` is the subtype, and `charset=UTF-8` is an optional parameter indicating the character encoding.
|
||||
|
||||
A subtype typically consists of a media format, but it may or must also contain other content, such as a tree prefix, producer, product or suffix, according to the different rules in registration trees.
|
||||
|
||||
Types, subtypes, and parameter names are case-insensitive. Parameter values are usually case-sensitive, but may be interpreted in a case-insensitive fashion depending on the intended use.
|
||||
|
||||
## Common MIME Types Files
|
||||
### Application
|
||||
| MIME Type | Extensions | Description |
|
||||
| --------------------------------- | ---------- | --------------------------------- |
|
||||
| application/epub+zip | epub | - |
|
||||
| application/gzip | gz tgz | [ZIP](ZIP.md) Files |
|
||||
| application/http | - | [HTTP](../internet/HTTP.md) |
|
||||
| application/javascript | .js | Javascript |
|
||||
| application/json | json | [JSON](JSON.md) Data |
|
||||
| application/pdf | pdf | [PDF](PDF.md) Document |
|
||||
| application/pem-certificate-chain | pem | Certificates |
|
||||
| application/pgp-encrypted | pgp | [PGP](../tools/GPG.md) Data |
|
||||
| application/pgp-keys | - | [PGP](../tools/GPG.md) Keys |
|
||||
| application/pgp-signature | sig | [PGP](../tools/GPG.md) Signatures |
|
||||
| application/rtf | rtf | RTF Document |
|
||||
| application/sql | sql | [SQL](../programming/languages/SQL.md) Databases |
|
||||
| application/wasm | wasm | WebAssembly |
|
||||
| application/xml | xml | [XML](XML.md) |
|
||||
| application/zip | zip | [ZIP](ZIP.md) Files |
|
||||
| application/zstd | zst | Zstd Compression |
|
||||
| application/x-bittorrent | torrent | [Torrent](../tools/BitTorrent.md) |
|
||||
| application/x-java-archive | jar | Java |
|
||||
| application/x-latex | latex | LATeX |
|
||||
| application/x-rpm | rpm | Fedora Package |
|
||||
| application/x-sh | sh | [Shell](../applications/cli/Shell.md) |
|
||||
| application/x-tar | tar | [TAR](../applications/cli/tar.md) |
|
||||
| application/x-xz | xz | XZ Compression |
|
||||
| application/msgpack | - | [MessagePack](MessagePack.md) |
|
||||
| application/toml | .toml | [TOML](TOML.md) |
|
||||
|
||||
### Audio
|
||||
| MIME Type | Extensions | Description |
|
||||
| ---------------- | ------------------- | -------------------------------------- |
|
||||
| audio/aac | adts, aac, ass | - |
|
||||
| audio/mp4 | m4a | - |
|
||||
| audio/mpeg | mp3, mpga, mp1, mp2 | - |
|
||||
| audio/ogg | oga, ogg, opus,spx | Ogg |
|
||||
| audio/opus | - | [Opus](../media/audio/Opus.md) |
|
||||
| audio/vorbis | - | Vorbis |
|
||||
| audio/midi | mid, midi | MIDI |
|
||||
| audio/x-aiff | aif, aiff, aifc | AIFF |
|
||||
| audio/x-flac | flac | [FLAC](../media/audio/FLAC.md) |
|
||||
| audio/x-matroska | mka | [Matroska](../media/Matroska.md) Audio |
|
||||
| audio/x-wav | wav | [WAV](../media/audio/WAV.md) |
|
||||
|
||||
### Font
|
||||
| MIME Type | Extensions | Description |
|
||||
| --------- | ---------- | ----------- |
|
||||
| font/ttf | ttf | - |
|
||||
| font/otf | otf | – |
|
||||
|
||||
### Image
|
||||
| MIME Type | Extensions | Description |
|
||||
| ------------- | -------------------- | ------------------------------------ |
|
||||
| image/heif | heif | HEIF Image |
|
||||
| image/avif | avif | [AVIF](../media/image/AVIF.md) Image |
|
||||
| image/bmp | bmp | BMP Image |
|
||||
| image/gif | gif | GIF Image |
|
||||
| image/jpeg | jpg, jpeg, jpe, jfif | JPEG Image |
|
||||
| image/jxl | jxl | - |
|
||||
| image/png | png | [PNG](../media/image/PNG.md) Image |
|
||||
| image/svg+xml | svg, svgz | SVG Image |
|
||||
| image/tiff | tiff, tif | TIFF Image |
|
||||
| image/webp | webp | WebP Image |
|
||||
|
||||
### Message
|
||||
| MIME Type | Extensions | Description |
|
||||
| ----------------------- | ---------- | ----------- |
|
||||
| message/delivery-status | - | - |
|
||||
| message/http | - | - |
|
||||
| message/partial | - | - |
|
||||
|
||||
### Model
|
||||
| MIME Type | Extensions | Description |
|
||||
| ---------- | --------------- | ----------- |
|
||||
| model/mesh | msh, mesh, silo | 3D Mesh |
|
||||
| model/obj | obj | 3D Object |
|
||||
|
||||
### Multipart
|
||||
| MIME Type | Extensions | Description |
|
||||
| ------------------- | ---------- | ----------- |
|
||||
| multipart/digest | - | - |
|
||||
| multipart/encrypted | - | - |
|
||||
| multipart/form-data | - | - |
|
||||
| multipart/parallel | - | - |
|
||||
|
||||
### Text
|
||||
| MIME Type | Extensions | Description |
|
||||
| -------------- | -------------------------------------------------------------- | --------------- |
|
||||
| text/calendar | ics | Calendar |
|
||||
| text/css | css | [CSS](../internet/CSS.md) Stylesheets |
|
||||
| text/csv | csv | [CSV](CSV.md) Data |
|
||||
| text/directory | - | - |
|
||||
| text/html | html, htm | [HTML](../internet/HTML.md) Data |
|
||||
| text/markdown | markdown, md | [Markdown](Markdown.md) |
|
||||
| text/plain | txt, asc, text, pm, el, c, h, cc, hh, cxx, hxx, f90, conf, log | Plain Text |
|
||||
| text/rtf | rtf | RTF Document |
|
||||
| text/xml | xml | [XML](XML.md) |
|
||||
|
||||
### Video
|
||||
| MIME Type | Extensions | Description |
|
||||
| ---------------- | ---------- | -------------------------------- |
|
||||
| video/AV1 | - | [AV1](../media/video/AV1.md) |
|
||||
| video/H264 | - | [H.264](../media/video/H.264.md) |
|
||||
| video/H265 | - | [H.265](../media/video/H.265.md) |
|
||||
| video/mp4 | mp4, m4a | MP4 Video |
|
||||
| video/quicktime | mov, qt | Quicktime |
|
||||
| video/webm | webm | WebM Video |
|
||||
| video/x-matroska | mkv | [Matroska](../media/Matroska.md) |
|
259
technology/files/Markdown.md
Normal file
259
technology/files/Markdown.md
Normal file
|
@ -0,0 +1,259 @@
|
|||
---
|
||||
obj: concept
|
||||
wiki: https://en.wikipedia.org/wiki/Markdown
|
||||
website: ["https://www.markdownguide.org", "https://commonmark.org"]
|
||||
---
|
||||
|
||||
# Markdown
|
||||
Markdown is a lightweight markup language that provides a simple and human-readable way to format plain text.
|
||||
|
||||
# Syntax
|
||||
## Basic Syntax
|
||||
### Headings
|
||||
To create a heading, add number signs (`#`) in front of a word or phrase. The number of number signs you use should correspond to the heading level. For example, to create a heading level three (`<h3>`), use three number signs (e.g., `### My Header`).
|
||||
```markdown
|
||||
# Heading 1
|
||||
## Heading 2
|
||||
### Heading 3
|
||||
```
|
||||
|
||||
### Paragraphs
|
||||
To create paragraphs, use a blank line to separate one or more lines of text.
|
||||
|
||||
### Line Breaks
|
||||
To create a line break or new line (`<br>`), end a line with two or more spaces, and then type return. Alternatively you can use inline [html](../internet/HTML.md) with the `<br>` tag.
|
||||
|
||||
### Emphasis
|
||||
You can add emphasis by making text bold or italic.
|
||||
|
||||
To bold text, add two asterisks or underscores before and after a word or phrase. To bold the middle of a word for emphasis, add two asterisks without spaces around the letters.
|
||||
```markdown
|
||||
**Bold** text
|
||||
```
|
||||
|
||||
To italicize text, add one asterisk or underscore before and after a word or phrase. To italicize the middle of a word for emphasis, add one asterisk without spaces around the letters.
|
||||
```markdown
|
||||
*Italic* text
|
||||
```
|
||||
|
||||
To emphasize text with bold and italics at the same time, add three asterisks or underscores before and after a word or phrase. To bold and italicize the middle of a word for emphasis, add three asterisks without spaces around the letters.
|
||||
```markdown
|
||||
***All at once** text
|
||||
```
|
||||
|
||||
### Blockquote
|
||||
To create a blockquote, add a `>` in front of a paragraph.
|
||||
```markdown
|
||||
> My blockquote
|
||||
```
|
||||
|
||||
Blockquotes can be nested. Add a `>>` in front of the paragraph you want to nest.
|
||||
|
||||
Blockquotes can contain other Markdown formatted elements. Not all elements can be used — you’ll need to experiment to see which ones work.
|
||||
|
||||
### Lists
|
||||
You can organize items into ordered and unordered lists.
|
||||
|
||||
To create an ordered list, add line items with numbers followed by periods. The numbers don’t have to be in numerical order, but the list should start with the number one.
|
||||
```markdown
|
||||
1. First
|
||||
2. Second
|
||||
3. Third
|
||||
```
|
||||
|
||||
To create an unordered list, add dashes (`-`), asterisks (`*`), or plus signs (`+`) in front of line items. Indent one or more items to create a nested list.
|
||||
```markdown
|
||||
- First
|
||||
- Second
|
||||
- Third
|
||||
```
|
||||
|
||||
### Code
|
||||
To denote a word or phrase as code, enclose it in backticks (`` ` ``).
|
||||
```markdown
|
||||
At the command prompt, type `nano`.
|
||||
```
|
||||
|
||||
### Horizontal rules
|
||||
To create a horizontal rule, use three or more asterisks (`***`), dashes (`---`), or underscores (`___`) on a line by themselves.
|
||||
|
||||
### Links
|
||||
To create a link, enclose the link text in brackets (e.g., `[Duck Duck Go]`) and then follow it immediately with the [URL](../internet/URL.md) in parentheses (e.g., `(https://duckduckgo.com)`).
|
||||
```markdown
|
||||
My favorite search engine is [Duck Duck Go](https://duckduckgo.com).
|
||||
```
|
||||
|
||||
Reference-style links are a special kind of link that make URLs easier to display and read in Markdown. Reference-style links are constructed in two parts: the part you keep inline with your text and the part you store somewhere else in the file to keep the text easy to read.
|
||||
|
||||
The first part of a reference-style link is formatted with two sets of brackets. The first set of brackets surrounds the text that should appear linked. The second set of brackets displays a label used to point to the link you’re storing elsewhere in your document.
|
||||
|
||||
The second part of a reference-style link is formatted with the following attributes:
|
||||
1. The label, in brackets, followed immediately by a colon and at least one space (e.g., `[label]:` ).
|
||||
2. The [URL](../internet/URL.md) for the link, which you can optionally enclose in angle brackets.
|
||||
3. The optional title for the link, which you can enclose in double quotes, single quotes, or parentheses.
|
||||
|
||||
```markdown
|
||||
This is my [reflink][reference]
|
||||
|
||||
[reference]: https://myurl.com
|
||||
```
|
||||
|
||||
You can place this second part of the link anywhere in your Markdown document. Some people place them immediately after the paragraph in which they appear while other people place them at the end of the document (like endnotes or footnotes).
|
||||
|
||||
### Images
|
||||
To add an image, add an exclamation mark (`!`), followed by alt text in brackets, and the path or [URL](../internet/URL.md) to the image asset in parentheses. The syntax is identical to links but with a `!` at the start.
|
||||
|
||||
### Escaping characters
|
||||
To display a literal character that would otherwise be used to format text in a Markdown document, add a backslash (`\`) in front of the character.
|
||||
You can use a backslash to escape the following characters.
|
||||
|
||||
| Character | Name |
|
||||
| ----------- | ------------------- |
|
||||
| \|backslash | |
|
||||
| \` | backtick |
|
||||
| \* | asterisk |
|
||||
| \_ | underscore |
|
||||
| { } | curly braces |
|
||||
| [ ] | brackets |
|
||||
| < > | angle brackets |
|
||||
| ( ) | parentheses |
|
||||
| # | pound sign |
|
||||
| + | plus sign |
|
||||
| - | minus sign (hyphen) |
|
||||
| . | dot |
|
||||
| ! | exclamation mark |
|
||||
| \| | pipe |
|
||||
|
||||
### HTML
|
||||
Many Markdown applications allow you to use [HTML](../internet/HTML.md) tags in Markdown-formatted text. This is helpful if you prefer certain [HTML](../internet/HTML.md) tags to Markdown syntax. For example, some people find it easier to use [HTML](../internet/HTML.md) tags for images. Using [HTML](../internet/HTML.md) is also helpful when you need to change the attributes of an element, like specifying the color of text or changing the width of an image.
|
||||
|
||||
## Extented Syntax
|
||||
### Tables
|
||||
To add a table, use three or more hyphens (`---`) to create each column’s header, and use pipes (`|`) to separate each column. For compatibility, you should also add a pipe on either end of the row.
|
||||
```markdown
|
||||
| Syntax | Description |
|
||||
| ----------- | ----------- |
|
||||
| Header | Title |
|
||||
| Paragraph | Text |
|
||||
```
|
||||
|
||||
### Fenced Code Blocks
|
||||
To create code blocks use three backticks at the start and end of the code block (` ``` ``` `).
|
||||
|
||||
Many Markdown processors support syntax highlighting for fenced code blocks. This feature allows you to add color highlighting for whatever language your code was written in. To add syntax highlighting, specify a language directly after the backticks on the first line of the fenced code block.
|
||||
|
||||
### Footnotes
|
||||
Footnotes allow you to add notes and references without cluttering the body of the document. When you create a footnote, a superscript number with a link appears where you added the footnote reference. Readers can click the link to jump to the content of the footnote at the bottom of the page.
|
||||
|
||||
To create a footnote reference, add a caret and an identifier inside brackets (`[^1]`). Identifiers can be numbers or words, but they can’t contain spaces or tabs. Identifiers only correlate the footnote reference with the footnote itself — in the output, footnotes are numbered sequentially.
|
||||
|
||||
Add the footnote using another caret and number inside brackets with a colon and text (`[^1]: My footnote.`). You don’t have to put footnotes at the end of the document. You can put them anywhere except inside other elements like lists, block quotes, and tables.
|
||||
```markdown
|
||||
Here's a simple footnote,[^1] and here's a longer one.[^bignote]
|
||||
|
||||
[^1]: This is the first footnote.
|
||||
|
||||
[^bignote]: Here's one with multiple paragraphs and code.
|
||||
```
|
||||
|
||||
### Heading IDs
|
||||
Many Markdown processors support custom IDs for headings — some Markdown processors automatically add them. Adding custom IDs allows you to link directly to headings and modify them with [CSS](../internet/CSS.md). To add a custom heading ID, enclose the custom ID in curly braces on the same line as the heading.
|
||||
```markdown
|
||||
### My Great Heading {#custom-id}
|
||||
```
|
||||
|
||||
The [HTML](../internet/HTML.md) looks like this:
|
||||
```html
|
||||
<h3 id="custom-id">My Great Heading</h3>
|
||||
```
|
||||
|
||||
You can link to headings with custom IDs in the file by creating a standard link with a number sign (#) followed by the custom heading ID. These are commonly referred to as anchor links.
|
||||
|
||||
| Markdown | HTML |
|
||||
| ----------------------------- | ---------------------------------------- |
|
||||
| `[Heading IDs](#heading-ids)` | `<a href="#heading-ids">Heading IDs</a>` |
|
||||
|
||||
### Strikethrough
|
||||
You can strikethrough words by putting a horizontal line through the center of them. The result looks ~~like this~~. This feature allows you to indicate that certain words are a mistake not meant for inclusion in the document. To strikethrough words, use two tilde symbols (`~~`) before and after the words.
|
||||
|
||||
### Task Lists
|
||||
Task lists (also referred to as _checklists_ and _todo_ lists) allow you to create a list of items with checkboxes. In Markdown applications that support task lists, checkboxes will be displayed next to the content. To create a task list, add dashes (`-`) and brackets with a space (`[ ]`) in front of task list items. To select a checkbox, add an `x` in between the brackets (`[x]`).
|
||||
|
||||
```markdown
|
||||
- [x] Write the press release
|
||||
- [ ] Update the website
|
||||
- [ ] Contact the media
|
||||
```
|
||||
|
||||
### Highlight
|
||||
This isn’t common, but some Markdown processors allow you to highlight text. The result looks ==like this==. To highlight words, use two equal signs (`==`) before and after the words.
|
||||
```markdown
|
||||
I need to highlight these ==very important words==.
|
||||
```
|
||||
|
||||
## Hacks
|
||||
### Center
|
||||
Having the ability to center text is a necessity when writing a paper or a report. Unfortunately, Markdown doesn’t have any concept of text alignment, so this must be done with [HTML](../internet/HTML.md) and [CSS](../internet/CSS.md).
|
||||
```html
|
||||
<p style="text-align:center">Center this text</p>
|
||||
```
|
||||
|
||||
### Color
|
||||
Markdown doesn’t allow you to change the color of text, so again we need [HTML](../internet/HTML.md) and [CSS](../internet/CSS.md).
|
||||
```html
|
||||
<p style="color: red">This text is red!</p>
|
||||
```
|
||||
|
||||
### Comments
|
||||
Some people need the ability to write sentences in their Markdown files that _will not_ appear in the rendered output. These comments are essentially hidden text. The text is viewable by the author of the document, but it’s not printed on the webpage or [PDF](PDF.md). Markdown doesn’t natively support comments, but several enterprising individuals have devised a solution.
|
||||
|
||||
To add a comment, place text inside brackets followed by a colon, a space, and a pound sign (e.g., `[comment]: #`). You should put blank lines before and after a comment.
|
||||
|
||||
```markdown
|
||||
Here's a paragraph that will be visible.
|
||||
|
||||
[This is a comment that will be hidden.]: #
|
||||
|
||||
And here's another paragraph that's visible.
|
||||
```
|
||||
|
||||
### Image Size
|
||||
The Markdown syntax for images doesn’t allow you to specify the width and height of images. If you need to resize an image and your Markdown processor supports [HTML](../internet/HTML.md), you can use the `img` [HTML](../internet/HTML.md) tag with the `width` and `height` attributes to set the dimensions of an image in pixels.
|
||||
```html
|
||||
<img src="image.png" width="200" height="100">
|
||||
```
|
||||
|
||||
### Symbols
|
||||
Markdown doesn’t provide special syntax for symbols. However, in most cases, you can copy and paste whatever symbol you want to use into your Markdown document. For example, if you need to display Pi (π), just find the symbol on a webpage and copy and paste it into your document. The symbol should appear as expected in the rendered output.
|
||||
|
||||
Alternatively, if your Markdown application supports [HTML](../internet/HTML.md), you can use the [HTML](../internet/HTML.md) entity for whatever symbol you want to use. For example, if you want to display the copyright sign (©), you can copy and paste the [HTML](../internet/HTML.md) entity for copyright (`©`) into your Markdown document.
|
||||
|
||||
Here’s a partial list of [HTML](../internet/HTML.md) entities for symbols:
|
||||
- Copyright (©) — `©`
|
||||
- Registered trademark (®) — `®`
|
||||
- Trademark (™) — `™`
|
||||
- Euro (€) — `€`
|
||||
- Left arrow (←) — `←`
|
||||
- Up arrow (↑) — `↑`
|
||||
- Right arrow (→) — `→`
|
||||
- Down arrow (↓) — `↓`
|
||||
- Degree (°) — `°`
|
||||
- Pi (π) — `π`
|
||||
|
||||
### Line Breaks Within Table Cells
|
||||
You can separate paragraphs within a table cell by using one or more `<br>` [HTML](../internet/HTML.md) tags.
|
||||
|
||||
## Frontmatter
|
||||
Frontmatter allows you to add structured metadata to your markdown files. Add a [YAML](YAML.md) document embedded in a three-dotted block at the top of your file.
|
||||
```markdown
|
||||
---
|
||||
key: value
|
||||
list:
|
||||
- first
|
||||
- second
|
||||
object:
|
||||
nested: structure
|
||||
---
|
||||
|
||||
# Markdown
|
||||
```
|
380
technology/files/MessagePack.md
Normal file
380
technology/files/MessagePack.md
Normal file
|
@ -0,0 +1,380 @@
|
|||
---
|
||||
obj: concept
|
||||
website: https://msgpack.org
|
||||
---
|
||||
|
||||
# MessagePack
|
||||
MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like [JSON](JSON.md). But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves.
|
||||
|
||||
## Specification
|
||||
MessagePack has two concepts: type system and formats.
|
||||
|
||||
## Types
|
||||
|
||||
- Integer represents an integer
|
||||
- Nil represents nil
|
||||
- Boolean represents true or false
|
||||
- Float represents a IEEE 754 double precision floating point number including NaN and Infinity
|
||||
- Raw
|
||||
- - String extending Raw type represents a UTF-8 string
|
||||
- - Binary extending Raw type represents a byte array
|
||||
- Array represents a sequence of objects
|
||||
- Map represents key-value pairs of objects
|
||||
- Extension represents a tuple of type information and a byte array where type information is an integer whose meaning is defined by applications or MessagePack specification
|
||||
- - Timestamp represents an instantaneous point on the time-line in the world that is independent from time zones or calendars. Maximum precision is nanoseconds.
|
||||
|
||||
## Formats
|
||||
### Overview
|
||||
|
||||
format name | first byte (in binary) | first byte (in hex)
|
||||
--------------- | ---------------------- | -------------------
|
||||
positive fixint | 0xxxxxxx | 0x00 - 0x7f
|
||||
fixmap | 1000xxxx | 0x80 - 0x8f
|
||||
fixarray | 1001xxxx | 0x90 - 0x9f
|
||||
fixstr | 101xxxxx | 0xa0 - 0xbf
|
||||
nil | 11000000 | 0xc0
|
||||
(never used) | 11000001 | 0xc1
|
||||
false | 11000010 | 0xc2
|
||||
true | 11000011 | 0xc3
|
||||
bin 8 | 11000100 | 0xc4
|
||||
bin 16 | 11000101 | 0xc5
|
||||
bin 32 | 11000110 | 0xc6
|
||||
ext 8 | 11000111 | 0xc7
|
||||
ext 16 | 11001000 | 0xc8
|
||||
ext 32 | 11001001 | 0xc9
|
||||
float 32 | 11001010 | 0xca
|
||||
float 64 | 11001011 | 0xcb
|
||||
uint 8 | 11001100 | 0xcc
|
||||
uint 16 | 11001101 | 0xcd
|
||||
uint 32 | 11001110 | 0xce
|
||||
uint 64 | 11001111 | 0xcf
|
||||
int 8 | 11010000 | 0xd0
|
||||
int 16 | 11010001 | 0xd1
|
||||
int 32 | 11010010 | 0xd2
|
||||
int 64 | 11010011 | 0xd3
|
||||
fixext 1 | 11010100 | 0xd4
|
||||
fixext 2 | 11010101 | 0xd5
|
||||
fixext 4 | 11010110 | 0xd6
|
||||
fixext 8 | 11010111 | 0xd7
|
||||
fixext 16 | 11011000 | 0xd8
|
||||
str 8 | 11011001 | 0xd9
|
||||
str 16 | 11011010 | 0xda
|
||||
str 32 | 11011011 | 0xdb
|
||||
array 16 | 11011100 | 0xdc
|
||||
array 32 | 11011101 | 0xdd
|
||||
map 16 | 11011110 | 0xde
|
||||
map 32 | 11011111 | 0xdf
|
||||
negative fixint | 111xxxxx | 0xe0 - 0xff
|
||||
|
||||
|
||||
### Notation in diagrams
|
||||
|
||||
one byte:
|
||||
+--------+
|
||||
| |
|
||||
+--------+
|
||||
|
||||
a variable number of bytes:
|
||||
+========+
|
||||
| |
|
||||
+========+
|
||||
|
||||
variable number of objects stored in MessagePack format:
|
||||
+~~~~~~~~~~~~~~~~~+
|
||||
| |
|
||||
+~~~~~~~~~~~~~~~~~+
|
||||
|
||||
`X`, `Y`, `Z` and `A` are the symbols that will be replaced by an actual bit.
|
||||
|
||||
### nil format
|
||||
|
||||
Nil format stores nil in 1 byte.
|
||||
|
||||
nil:
|
||||
+--------+
|
||||
| 0xc0 |
|
||||
+--------+
|
||||
|
||||
### bool format family
|
||||
|
||||
Bool format family stores false or true in 1 byte.
|
||||
|
||||
false:
|
||||
+--------+
|
||||
| 0xc2 |
|
||||
+--------+
|
||||
|
||||
true:
|
||||
+--------+
|
||||
| 0xc3 |
|
||||
+--------+
|
||||
|
||||
### int format family
|
||||
|
||||
Int format family stores an integer in 1, 2, 3, 5, or 9 bytes.
|
||||
|
||||
positive fixint stores 7-bit positive integer
|
||||
+--------+
|
||||
|0XXXXXXX|
|
||||
+--------+
|
||||
|
||||
negative fixint stores 5-bit negative integer
|
||||
+--------+
|
||||
|111YYYYY|
|
||||
+--------+
|
||||
|
||||
* 0XXXXXXX is 8-bit unsigned integer
|
||||
* 111YYYYY is 8-bit signed integer
|
||||
|
||||
uint 8 stores a 8-bit unsigned integer
|
||||
+--------+--------+
|
||||
| 0xcc |ZZZZZZZZ|
|
||||
+--------+--------+
|
||||
|
||||
uint 16 stores a 16-bit big-endian unsigned integer
|
||||
+--------+--------+--------+
|
||||
| 0xcd |ZZZZZZZZ|ZZZZZZZZ|
|
||||
+--------+--------+--------+
|
||||
|
||||
uint 32 stores a 32-bit big-endian unsigned integer
|
||||
+--------+--------+--------+--------+--------+
|
||||
| 0xce |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|
|
||||
+--------+--------+--------+--------+--------+
|
||||
|
||||
uint 64 stores a 64-bit big-endian unsigned integer
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
| 0xcf |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
|
||||
int 8 stores a 8-bit signed integer
|
||||
+--------+--------+
|
||||
| 0xd0 |ZZZZZZZZ|
|
||||
+--------+--------+
|
||||
|
||||
int 16 stores a 16-bit big-endian signed integer
|
||||
+--------+--------+--------+
|
||||
| 0xd1 |ZZZZZZZZ|ZZZZZZZZ|
|
||||
+--------+--------+--------+
|
||||
|
||||
int 32 stores a 32-bit big-endian signed integer
|
||||
+--------+--------+--------+--------+--------+
|
||||
| 0xd2 |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|
|
||||
+--------+--------+--------+--------+--------+
|
||||
|
||||
int 64 stores a 64-bit big-endian signed integer
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
| 0xd3 |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
|
||||
### float format family
|
||||
|
||||
Float format family stores a floating point number in 5 bytes or 9 bytes.
|
||||
|
||||
float 32 stores a floating point number in IEEE 754 single precision floating point number format:
|
||||
+--------+--------+--------+--------+--------+
|
||||
| 0xca |XXXXXXXX|XXXXXXXX|XXXXXXXX|XXXXXXXX|
|
||||
+--------+--------+--------+--------+--------+
|
||||
|
||||
float 64 stores a floating point number in IEEE 754 double precision floating point number format:
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
| 0xcb |YYYYYYYY|YYYYYYYY|YYYYYYYY|YYYYYYYY|YYYYYYYY|YYYYYYYY|YYYYYYYY|YYYYYYYY|
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
|
||||
where
|
||||
* XXXXXXXX_XXXXXXXX_XXXXXXXX_XXXXXXXX is a big-endian IEEE 754 single precision floating point number.
|
||||
Extension of precision from single-precision to double-precision does not lose precision.
|
||||
* YYYYYYYY_YYYYYYYY_YYYYYYYY_YYYYYYYY_YYYYYYYY_YYYYYYYY_YYYYYYYY_YYYYYYYY is a big-endian
|
||||
IEEE 754 double precision floating point number
|
||||
|
||||
### str format family
|
||||
|
||||
Str format family stores a byte array in 1, 2, 3, or 5 bytes of extra bytes in addition to the size of the byte array.
|
||||
|
||||
fixstr stores a byte array whose length is upto 31 bytes:
|
||||
+--------+========+
|
||||
|101XXXXX| data |
|
||||
+--------+========+
|
||||
|
||||
str 8 stores a byte array whose length is upto (2^8)-1 bytes:
|
||||
+--------+--------+========+
|
||||
| 0xd9 |YYYYYYYY| data |
|
||||
+--------+--------+========+
|
||||
|
||||
str 16 stores a byte array whose length is upto (2^16)-1 bytes:
|
||||
+--------+--------+--------+========+
|
||||
| 0xda |ZZZZZZZZ|ZZZZZZZZ| data |
|
||||
+--------+--------+--------+========+
|
||||
|
||||
str 32 stores a byte array whose length is upto (2^32)-1 bytes:
|
||||
+--------+--------+--------+--------+--------+========+
|
||||
| 0xdb |AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA| data |
|
||||
+--------+--------+--------+--------+--------+========+
|
||||
|
||||
where
|
||||
* XXXXX is a 5-bit unsigned integer which represents N
|
||||
* YYYYYYYY is a 8-bit unsigned integer which represents N
|
||||
* ZZZZZZZZ_ZZZZZZZZ is a 16-bit big-endian unsigned integer which represents N
|
||||
* AAAAAAAA_AAAAAAAA_AAAAAAAA_AAAAAAAA is a 32-bit big-endian unsigned integer which represents N
|
||||
* N is the length of data
|
||||
|
||||
### bin format family
|
||||
|
||||
Bin format family stores an byte array in 2, 3, or 5 bytes of extra bytes in addition to the size of the byte array.
|
||||
|
||||
bin 8 stores a byte array whose length is upto (2^8)-1 bytes:
|
||||
+--------+--------+========+
|
||||
| 0xc4 |XXXXXXXX| data |
|
||||
+--------+--------+========+
|
||||
|
||||
bin 16 stores a byte array whose length is upto (2^16)-1 bytes:
|
||||
+--------+--------+--------+========+
|
||||
| 0xc5 |YYYYYYYY|YYYYYYYY| data |
|
||||
+--------+--------+--------+========+
|
||||
|
||||
bin 32 stores a byte array whose length is upto (2^32)-1 bytes:
|
||||
+--------+--------+--------+--------+--------+========+
|
||||
| 0xc6 |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ| data |
|
||||
+--------+--------+--------+--------+--------+========+
|
||||
|
||||
where
|
||||
* XXXXXXXX is a 8-bit unsigned integer which represents N
|
||||
* YYYYYYYY_YYYYYYYY is a 16-bit big-endian unsigned integer which represents N
|
||||
* ZZZZZZZZ_ZZZZZZZZ_ZZZZZZZZ_ZZZZZZZZ is a 32-bit big-endian unsigned integer which represents N
|
||||
* N is the length of data
|
||||
|
||||
### array format family
|
||||
|
||||
Array format family stores a sequence of elements in 1, 3, or 5 bytes of extra bytes in addition to the elements.
|
||||
|
||||
fixarray stores an array whose length is upto 15 elements:
|
||||
+--------+~~~~~~~~~~~~~~~~~+
|
||||
|1001XXXX| N objects |
|
||||
+--------+~~~~~~~~~~~~~~~~~+
|
||||
|
||||
array 16 stores an array whose length is upto (2^16)-1 elements:
|
||||
+--------+--------+--------+~~~~~~~~~~~~~~~~~+
|
||||
| 0xdc |YYYYYYYY|YYYYYYYY| N objects |
|
||||
+--------+--------+--------+~~~~~~~~~~~~~~~~~+
|
||||
|
||||
array 32 stores an array whose length is upto (2^32)-1 elements:
|
||||
+--------+--------+--------+--------+--------+~~~~~~~~~~~~~~~~~+
|
||||
| 0xdd |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ| N objects |
|
||||
+--------+--------+--------+--------+--------+~~~~~~~~~~~~~~~~~+
|
||||
|
||||
where
|
||||
* XXXX is a 4-bit unsigned integer which represents N
|
||||
* YYYYYYYY_YYYYYYYY is a 16-bit big-endian unsigned integer which represents N
|
||||
* ZZZZZZZZ_ZZZZZZZZ_ZZZZZZZZ_ZZZZZZZZ is a 32-bit big-endian unsigned integer which represents N
|
||||
* N is the size of an array
|
||||
|
||||
### map format family
|
||||
|
||||
Map format family stores a sequence of key-value pairs in 1, 3, or 5 bytes of extra bytes in addition to the key-value pairs.
|
||||
|
||||
fixmap stores a map whose length is upto 15 elements
|
||||
+--------+~~~~~~~~~~~~~~~~~+
|
||||
|1000XXXX| N*2 objects |
|
||||
+--------+~~~~~~~~~~~~~~~~~+
|
||||
|
||||
map 16 stores a map whose length is upto (2^16)-1 elements
|
||||
+--------+--------+--------+~~~~~~~~~~~~~~~~~+
|
||||
| 0xde |YYYYYYYY|YYYYYYYY| N*2 objects |
|
||||
+--------+--------+--------+~~~~~~~~~~~~~~~~~+
|
||||
|
||||
map 32 stores a map whose length is upto (2^32)-1 elements
|
||||
+--------+--------+--------+--------+--------+~~~~~~~~~~~~~~~~~+
|
||||
| 0xdf |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ| N*2 objects |
|
||||
+--------+--------+--------+--------+--------+~~~~~~~~~~~~~~~~~+
|
||||
|
||||
where
|
||||
* XXXX is a 4-bit unsigned integer which represents N
|
||||
* YYYYYYYY_YYYYYYYY is a 16-bit big-endian unsigned integer which represents N
|
||||
* ZZZZZZZZ_ZZZZZZZZ_ZZZZZZZZ_ZZZZZZZZ is a 32-bit big-endian unsigned integer which represents N
|
||||
* N is the size of a map
|
||||
* odd elements in objects are keys of a map
|
||||
* the next element of a key is its associated value
|
||||
|
||||
### ext format family
|
||||
|
||||
Ext format family stores a tuple of an integer and a byte array.
|
||||
|
||||
fixext 1 stores an integer and a byte array whose length is 1 byte
|
||||
+--------+--------+--------+
|
||||
| 0xd4 | type | data |
|
||||
+--------+--------+--------+
|
||||
|
||||
fixext 2 stores an integer and a byte array whose length is 2 bytes
|
||||
+--------+--------+--------+--------+
|
||||
| 0xd5 | type | data |
|
||||
+--------+--------+--------+--------+
|
||||
|
||||
fixext 4 stores an integer and a byte array whose length is 4 bytes
|
||||
+--------+--------+--------+--------+--------+--------+
|
||||
| 0xd6 | type | data |
|
||||
+--------+--------+--------+--------+--------+--------+
|
||||
|
||||
fixext 8 stores an integer and a byte array whose length is 8 bytes
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
| 0xd7 | type | data |
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
|
||||
fixext 16 stores an integer and a byte array whose length is 16 bytes
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
| 0xd8 | type | data
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
data (cont.) |
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
|
||||
ext 8 stores an integer and a byte array whose length is upto (2^8)-1 bytes:
|
||||
+--------+--------+--------+========+
|
||||
| 0xc7 |XXXXXXXX| type | data |
|
||||
+--------+--------+--------+========+
|
||||
|
||||
ext 16 stores an integer and a byte array whose length is upto (2^16)-1 bytes:
|
||||
+--------+--------+--------+--------+========+
|
||||
| 0xc8 |YYYYYYYY|YYYYYYYY| type | data |
|
||||
+--------+--------+--------+--------+========+
|
||||
|
||||
ext 32 stores an integer and a byte array whose length is upto (2^32)-1 bytes:
|
||||
+--------+--------+--------+--------+--------+--------+========+
|
||||
| 0xc9 |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ| type | data |
|
||||
+--------+--------+--------+--------+--------+--------+========+
|
||||
|
||||
where
|
||||
* XXXXXXXX is a 8-bit unsigned integer which represents N
|
||||
* YYYYYYYY_YYYYYYYY is a 16-bit big-endian unsigned integer which represents N
|
||||
* ZZZZZZZZ_ZZZZZZZZ_ZZZZZZZZ_ZZZZZZZZ is a big-endian 32-bit unsigned integer which represents N
|
||||
* N is a length of data
|
||||
* type is a signed 8-bit signed integer
|
||||
* type < 0 is reserved for future extension including 2-byte type information
|
||||
|
||||
### Timestamp extension type
|
||||
|
||||
Timestamp extension type is assigned to extension type `-1`. It defines 3 formats: 32-bit format, 64-bit format, and 96-bit format.
|
||||
|
||||
timestamp 32 stores the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC
|
||||
in an 32-bit unsigned integer:
|
||||
+--------+--------+--------+--------+--------+--------+
|
||||
| 0xd6 | -1 | seconds in 32-bit unsigned int |
|
||||
+--------+--------+--------+--------+--------+--------+
|
||||
|
||||
timestamp 64 stores the number of seconds and nanoseconds that have elapsed since 1970-01-01 00:00:00 UTC
|
||||
in 32-bit unsigned integers:
|
||||
+--------+--------+--------+--------+--------+------|-+--------+--------+--------+--------+
|
||||
| 0xd7 | -1 | nanosec. in 30-bit unsigned int | seconds in 34-bit unsigned int |
|
||||
+--------+--------+--------+--------+--------+------^-+--------+--------+--------+--------+
|
||||
|
||||
timestamp 96 stores the number of seconds and nanoseconds that have elapsed since 1970-01-01 00:00:00 UTC
|
||||
in 64-bit signed integer and 32-bit unsigned integer:
|
||||
+--------+--------+--------+--------+--------+--------+--------+
|
||||
| 0xc7 | 12 | -1 |nanoseconds in 32-bit unsigned int |
|
||||
+--------+--------+--------+--------+--------+--------+--------+
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
seconds in 64-bit signed int |
|
||||
+--------+--------+--------+--------+--------+--------+--------+--------+
|
||||
|
||||
* Timestamp 32 format can represent a timestamp in [1970-01-01 00:00:00 UTC, 2106-02-07 06:28:16 UTC) range. Nanoseconds part is 0.
|
||||
* Timestamp 64 format can represent a timestamp in [1970-01-01 00:00:00.000000000 UTC, 2514-05-30 01:53:04.000000000 UTC) range.
|
||||
* Timestamp 96 format can represent a timestamp in [-292277022657-01-27 08:29:52 UTC, 292277026596-12-04 15:30:08.000000000 UTC) range.
|
||||
* In timestamp 64 and timestamp 96 formats, nanoseconds must not be larger than 999999999.
|
13
technology/files/PDF.md
Normal file
13
technology/files/PDF.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
obj: concept
|
||||
---
|
||||
|
||||
# PDF
|
||||
Portable Document Format (PDF) is a widely-used file format developed by Adobe Inc. in the early 1990s. PDF files are known for their ability to present documents consistently across different platforms and devices.
|
||||
|
||||
## Key Features
|
||||
1. **Platform Independence:** PDF files can be viewed on various operating systems, including [Windows](../windows/Windows.md), [macOS](../macos/macOS.md), and [Linux](../linux/Linux.md), making them highly portable and independent of the software or hardware used.
|
||||
2. **Consistent Formatting:** PDFs maintain consistent formatting across different devices and software applications, ensuring that the document's layout, fonts, and images appear the same way regardless of the viewing environment.
|
||||
3. **Security:** PDFs support encryption and password protection, allowing users to secure their documents and control access to sensitive information.
|
||||
4. **Interactive Elements:** PDFs can include interactive elements such as hyperlinks, forms, and multimedia, enhancing the user experience and providing additional functionality beyond static documents.
|
||||
5. **Compression:** PDF files can be compressed to reduce file size without compromising the quality of the content, making them suitable for efficient storage and transmission.
|
407
technology/files/TOML.md
Normal file
407
technology/files/TOML.md
Normal file
|
@ -0,0 +1,407 @@
|
|||
---
|
||||
obj: concept
|
||||
website: https://toml.io
|
||||
repo: https://github.com/toml-lang/toml
|
||||
wiki: https://en.wikipedia.org/wiki/TOML
|
||||
---
|
||||
|
||||
# TOML
|
||||
TOML aims to be a minimal configuration file format that's easy to read due to obvious semantics. TOML is designed to map unambiguously to a hash table. TOML should be easy to parse into data structures in a wide variety of languages.
|
||||
|
||||
## Specification
|
||||
### Comment
|
||||
A hash symbol marks the rest of the line as a comment, except when inside a string.
|
||||
|
||||
```toml
|
||||
# This is a full-line comment
|
||||
key = "value" # This is a comment at the end of a line
|
||||
another = "# This is not a comment"
|
||||
```
|
||||
|
||||
### Key/Value Pair
|
||||
The primary building block of a TOML document is the key/value pair.
|
||||
|
||||
Keys are on the left of the equals sign and values are on the right. Whitespace is ignored around key names and values. The key, equals sign, and value must be on the same line (though some values can be broken over multiple lines).
|
||||
|
||||
```toml
|
||||
key = "value"
|
||||
```
|
||||
|
||||
Values must have one of the following types.
|
||||
- String
|
||||
- Integer
|
||||
- Float
|
||||
- Boolean
|
||||
- Offset Date-Time
|
||||
- Local Date-Time
|
||||
- Local Dat`
|
||||
- Local Time
|
||||
- Array
|
||||
- Inline Table
|
||||
|
||||
Unspecified values are invalid.
|
||||
|
||||
### Keys
|
||||
A key may be either bare, quoted, or dotted.
|
||||
|
||||
**Bare keys** may only contain [ASCII](ASCII.md) letters, [ASCII](ASCII.md) digits, underscores, and dashes (`A-Za-z0-9_-`). Note that bare keys are allowed to be composed of only [ASCII](ASCII.md) digits, e.g. `1234`, but are always interpreted as strings`
|
||||
```toml
|
||||
key = "value"
|
||||
bare_key = "value"
|
||||
bare-key = "value"
|
||||
1234 = "value"
|
||||
```
|
||||
|
||||
**Quoted keys** follow the exact same rules as either basic strings or literal strings and allow you to use a much broader set of key names. Best practice is to use bare keys except when absolutely necessary.
|
||||
```toml
|
||||
"127.0.0.1" = "value"
|
||||
"character encoding" = "value"
|
||||
"ʎǝʞ" = "value"
|
||||
'key2' = "value"
|
||||
'quoted "value"' = "value"
|
||||
```
|
||||
|
||||
**Dotted keys** are a sequence of bare or quoted keys joined with a dot. This allows for grouping similar properties together:
|
||||
```toml
|
||||
name = "Orange"
|
||||
physical.color = "orange"
|
||||
physical.shape = "round"
|
||||
site."google.com" = true
|
||||
```
|
||||
|
||||
In [JSON](JSON.md) land, that would give you the following structure:
|
||||
```json
|
||||
{
|
||||
"name": "Orange",
|
||||
"physical": {
|
||||
"color": "orange",
|
||||
"shape": "round"
|
||||
},
|
||||
"site": {
|
||||
"google.com": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Strings
|
||||
There are four ways to express strings: basic, multi-line basic, literal, and multi-line literal. All strings must contain only valid UTF-8 characters.
|
||||
|
||||
**Basic strings** are surrounded by quotation marks (`"`). Any [Unicode](Unicode.md) character may be used except those that must be escaped: quotation mark, backslash, and the control characters other than tab (U+0000 to U+0008, U+000A to U+001F, U+007F).
|
||||
|
||||
```toml
|
||||
str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
|
||||
```
|
||||
|
||||
For convenience, some popular characters have a compact escape sequence.
|
||||
```
|
||||
\b - backspace (U+0008)
|
||||
\t - tab (U+0009)
|
||||
\n - linefeed (U+000A)
|
||||
\f - form feed (U+000C)
|
||||
\r - carriage return (U+000D)
|
||||
\" - quote (U+0022)
|
||||
\\ - backslash (U+005C)
|
||||
\uXXXX - unicode (U+XXXX)
|
||||
\UXXXXXXXX - unicode (U+XXXXXXXX)
|
||||
```
|
||||
|
||||
**Multi-line basic strings** are surrounded by three quotation marks on each side and allow newlines. A newline immediately following the opening delimiter will be trimmed. All other whitespace and newline characters remain intact.
|
||||
|
||||
```toml
|
||||
str1 = """
|
||||
Roses are red
|
||||
Violets are blue"""
|
||||
```
|
||||
|
||||
**Literal strings** are surrounded by single quotes. Like basic strings, they must appear on a single line:
|
||||
```toml
|
||||
# What you see is what you get.
|
||||
winpath = 'C:\Users\nodejs\templates'
|
||||
winpath2 = '\\ServerX\admin$\system32\'
|
||||
quoted = 'Tom "Dubs" Preston-Werner'
|
||||
regex = '<\i\c*\s*>'
|
||||
```
|
||||
|
||||
**Multi-line literal strings** are surrounded by three single quotes on each side and allow newlines. Like literal strings, there is no escaping whatsoever. A newline immediately following the opening delimiter will be trimmed. All other content between the delimiters is interpreted as-is without modification.
|
||||
```toml
|
||||
regex2 = '''I [dw]on't need \d{2} apples'''
|
||||
lines = '''
|
||||
The first newline is
|
||||
trimmed in raw strings.
|
||||
All other whitespace
|
||||
is preserved.
|
||||
'''
|
||||
```
|
||||
|
||||
### Integer
|
||||
Integers are whole numbers. Positive numbers may be prefixed with a plus sign. Negative numbers are prefixed with a minus sign.
|
||||
```toml
|
||||
int1 = +99
|
||||
int2 = 42
|
||||
int3 = 0
|
||||
int4 = -17
|
||||
```
|
||||
|
||||
For large numbers, you may use underscores between digits to enhance readability. Each underscore must be surrounded by at least one digit on each side.
|
||||
```toml
|
||||
int5 = 1_000
|
||||
int6 = 5_349_221
|
||||
```
|
||||
|
||||
Non-negative integer values may also be expressed in hexadecimal, octal, or binary. In these formats, leading + is not allowed and leading zeros are allowed (after the prefix). Hex values are case-insensitive. Underscores are allowed between digits (but not between the prefix and the value).
|
||||
```toml
|
||||
# hexadecimal with prefix `0x`
|
||||
hex1 = 0xDEADBEEF
|
||||
hex2 = 0xdeadbeef
|
||||
hex3 = 0xdead_beef
|
||||
|
||||
# octal with prefix `0o`
|
||||
oct1 = 0o01234567
|
||||
oct2 = 0o755 # useful for Unix file permissions
|
||||
|
||||
# binary with prefix `0b`
|
||||
bin1 = 0b11010110
|
||||
```
|
||||
|
||||
### Float
|
||||
Floats should be implemented as IEEE 754 binary64 values.
|
||||
|
||||
A float consists of an integer part (which follows the same rules as decimal integer values) followed by a fractional part and/or an exponent part. If both a fractional part and exponent part are present, the fractional part must precede the exponent part.
|
||||
```toml
|
||||
# fractional
|
||||
flt1 = +1.0
|
||||
flt2 = 3.1415
|
||||
flt3 = -0.01
|
||||
|
||||
# exponent
|
||||
flt4 = 5e+22
|
||||
flt5 = 1e06
|
||||
flt6 = -2E-2
|
||||
|
||||
# both
|
||||
flt7 = 6.626e-34
|
||||
```
|
||||
|
||||
Similar to integers, you may use underscores to enhance readability. Each underscore must be surrounded by at least one digit.
|
||||
```toml
|
||||
flt8 = 224_617.445_991_228
|
||||
```
|
||||
|
||||
Special float values can also be expressed. They are always lowercase.
|
||||
```toml
|
||||
# infinity
|
||||
sf1 = inf # positive infinity
|
||||
sf2 = +inf # positive infinity
|
||||
sf3 = -inf # negative infinity
|
||||
|
||||
# not a number
|
||||
sf4 = nan # actual sNaN/qNaN encoding is implementation-specific
|
||||
sf5 = +nan # same as `nan`
|
||||
sf6 = -nan # valid, actual encoding is implementation-specific
|
||||
```
|
||||
|
||||
### Boolean
|
||||
Booleans are just the tokens you're used to. Always lowercase.
|
||||
```toml
|
||||
bool1 = true
|
||||
bool2 = false
|
||||
```
|
||||
|
||||
### Offset Date-Time
|
||||
To unambiguously represent a specific instant in time, you may use an RFC 3339 formatted date-time with offset.
|
||||
```toml
|
||||
odt1 = 1979-05-27T07:32:00Z
|
||||
odt2 = 1979-05-27T00:32:00-07:00
|
||||
odt3 = 1979-05-27T00:32:00.999999-07:00
|
||||
```
|
||||
|
||||
For the sake of readability, you may replace the T delimiter between date and time with a space character (as permitted by RFC 3339 section 5.6).
|
||||
```toml
|
||||
odt4 = 1979-05-27 07:32:00Z
|
||||
```
|
||||
|
||||
### Local Date Time
|
||||
If you omit the offset from an RFC 3339 formatted date-time, it will represent the given date-time without any relation to an offset or timezone. It cannot be converted to an instant in time without additional information. Conversion to an instant, if required, is implementation-specific.
|
||||
```toml
|
||||
ldt1 = 1979-05-27T07:32:00
|
||||
ldt2 = 1979-05-27T00:32:00.999999
|
||||
```
|
||||
|
||||
### Local Date
|
||||
If you include only the date portion of an RFC 3339 formatted date-time, it will represent that entire day without any relation to an offset or timezone.
|
||||
```toml
|
||||
ld1 = 1979-05-27
|
||||
```
|
||||
|
||||
### Local Time
|
||||
If you include only the time portion of an RFC 3339 formatted date-time, it will represent that time of day without any relation to a specific day or any offset or timezone.
|
||||
```toml
|
||||
lt1 = 07:32:00
|
||||
lt2 = 00:32:00.999999
|
||||
```
|
||||
|
||||
### Array
|
||||
Arrays are square brackets with values inside. Whitespace is ignored. Elements are separated by commas. Arrays can contain values of the same data types as allowed in key/value pairs. Values of different types may be mixed.
|
||||
```toml
|
||||
integers = [ 1, 2, 3 ]
|
||||
colors = [ "red", "yellow", "green" ]
|
||||
nested_arrays_of_ints = [ [ 1, 2 ], [3, 4, 5] ]
|
||||
nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ]
|
||||
string_array = [ "all", 'strings', """are the same""", '''type''' ]
|
||||
|
||||
# Mixed-type arrays are allowed
|
||||
numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
|
||||
contributors = [
|
||||
"Foo Bar <foo@example.com>",
|
||||
{ name = "Baz Qux", email = "bazqux@example.com", url = "https://example.com/bazqux" }
|
||||
]
|
||||
```
|
||||
|
||||
Arrays can span multiple lines. A terminating comma (also called a trailing comma) is permitted after the last value of the array. Any number of newlines and comments may precede values, commas, and the closing bracket. Indentation between array values and commas is treated as whitespace and ignored.
|
||||
```toml
|
||||
integers2 = [
|
||||
1, 2, 3
|
||||
]
|
||||
|
||||
integers3 = [
|
||||
1,
|
||||
2, # this is ok
|
||||
]
|
||||
```
|
||||
|
||||
### Table
|
||||
Tables (also known as hash tables or dictionaries) are collections of key/value pairs. They are defined by headers, with square brackets on a line by themselves. You can tell headers apart from arrays because arrays are only ever values.
|
||||
```toml
|
||||
[table]
|
||||
```
|
||||
|
||||
Under that, and until the next header or EOF, are the key/values of that table. Key/value pairs within tables are not guaranteed to be in any specific order.
|
||||
```toml
|
||||
[table-1]
|
||||
key1 = "some string"
|
||||
key2 = 123
|
||||
|
||||
[table-2]
|
||||
key1 = "another string"
|
||||
key2 = 456
|
||||
```
|
||||
|
||||
Naming rules for tables are the same as for keys
|
||||
|
||||
```toml
|
||||
[dog."tater.man"]
|
||||
type.name = "pug"
|
||||
```
|
||||
|
||||
In [JSON](JSON.md) land, that would give you the following structure:
|
||||
```json
|
||||
{ "dog": { "tater.man": { "type": { "name": "pug" } } } }
|
||||
```
|
||||
|
||||
### Inline Table
|
||||
Inline tables provide a more compact syntax for expressing tables. They are especially useful for grouped data that can otherwise quickly become verbose. Inline tables are fully defined within curly braces: `{` and `}`. Within the braces, zero or more comma-separated key/value pairs may appear. Key/value pairs take the same form as key/value pairs in standard tables. All value types are allowed, including inline tables.
|
||||
|
||||
Inline tables are intended to appear on a single line. A terminating comma (also called trailing comma) is not permitted after the last key/value pair in an inline table. No newlines are allowed between the curly braces unless they are valid within a value. Even so, it is strongly discouraged to break an inline table onto multiples lines. If you find yourself gripped with this desire, it means you should be using standard tables.
|
||||
```toml
|
||||
name = { first = "Tom", last = "Preston-Werner" }
|
||||
point = { x = 1, y = 2 }
|
||||
animal = { type.name = "pug" }
|
||||
```
|
||||
|
||||
The inline tables above are identical to the following standard table definitions:
|
||||
```toml
|
||||
[name]
|
||||
first = "Tom"
|
||||
last = "Preston-Werner"
|
||||
|
||||
[point]
|
||||
x = 1
|
||||
y = 2
|
||||
|
||||
[animal]
|
||||
type.name = "pug"
|
||||
```
|
||||
|
||||
Inline tables are fully self-contained and define all keys and sub-tables within them. Keys and sub-tables cannot be added outside the braces.
|
||||
|
||||
### Array of Tables
|
||||
The last syntax that has not yet been described allows writing arrays of tables. These can be expressed by using a header with a name in double brackets. The first instance of that header defines the array and its first table element, and each subsequent instance creates and defines a new table element in that array. The tables are inserted into the array in the order encountered.
|
||||
```toml
|
||||
[[products]]
|
||||
name = "Hammer"
|
||||
sku = 738594937
|
||||
|
||||
[[products]] # empty table within the array
|
||||
|
||||
[[products]]
|
||||
name = "Nail"
|
||||
sku = 284758393
|
||||
|
||||
color = "gray"
|
||||
```
|
||||
|
||||
In [JSON](JSON.md) land, that would give you the following structure.
|
||||
```json
|
||||
{
|
||||
"products": [
|
||||
{ "name": "Hammer", "sku": 738594937 },
|
||||
{ },
|
||||
{ "name": "Nail", "sku": 284758393, "color": "gray" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Any reference to an array of tables points to the most recently defined table element of the array. This allows you to define sub-tables, and even sub-arrays of tables, inside the most recent table.
|
||||
```toml
|
||||
[[fruits]]
|
||||
name = "apple"
|
||||
|
||||
[fruits.physical] # subtable
|
||||
color = "red"
|
||||
shape = "round"
|
||||
|
||||
[[fruits.varieties]] # nested array of tables
|
||||
name = "red delicious"
|
||||
|
||||
[[fruits.varieties]]
|
||||
name = "granny smith"
|
||||
|
||||
|
||||
[[fruits]]
|
||||
name = "banana"
|
||||
|
||||
[[fruits.varieties]]
|
||||
name = "plantain"
|
||||
```
|
||||
|
||||
The above TOML maps to the following [JSON](JSON.md).
|
||||
```json
|
||||
{
|
||||
"fruits": [
|
||||
{
|
||||
"name": "apple",
|
||||
"physical": {
|
||||
"color": "red",
|
||||
"shape": "round"
|
||||
},
|
||||
"varieties": [
|
||||
{ "name": "red delicious" },
|
||||
{ "name": "granny smith" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "banana",
|
||||
"varieties": [
|
||||
{ "name": "plantain" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
You may also use inline tables where appropriate:
|
||||
```toml
|
||||
points = [ { x = 1, y = 2, z = 3 },
|
||||
{ x = 7, y = 8, z = 9 },
|
||||
{ x = 2, y = 4, z = 8 } ]
|
||||
```
|
58
technology/files/Unicode.md
Normal file
58
technology/files/Unicode.md
Normal file
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
obj: concept
|
||||
website: https://unicode.org
|
||||
---
|
||||
|
||||
# Unicode
|
||||
Unicode is a standardized character encoding system that aims to represent text in most of the world's writing systems consistently. It provides a unique code point for every character, regardless of platform, program, or language. Unicode allows for the consistent representation of text across different devices and applications, fostering global communication and interoperability.
|
||||
|
||||
## **Code Points:**
|
||||
Unicode assigns a unique numerical value to each character, symbol, or glyph, known as a code point. These code points are typically represented in hexadecimal.
|
||||
|
||||
## **Character Sets:**
|
||||
Unicode encompasses a vast range of character sets, including Latin, Greek, Cyrillic, Arabic, Chinese, Japanese, and many more. This inclusivity allows Unicode to support a diverse array of languages and scripts.
|
||||
|
||||
## **Multilingual Support:**
|
||||
Unicode is designed to be multilingual, providing a single character encoding standard that can represent text in multiple languages simultaneously.
|
||||
|
||||
## **UTF Encoding Schemes:**
|
||||
Unicode Transformation Format (UTF) is the encoding scheme used to serialize Unicode code points into binary data. Common UTF variants include UTF-8, UTF-16, and UTF-32.
|
||||
|
||||
## **Compatibility and Normalization:**
|
||||
Unicode addresses compatibility issues, offering compatibility equivalence for characters that look similar but have different underlying code points. Unicode normalization ensures consistent representation.
|
||||
|
||||
## Character Representation
|
||||
### 1. **Code Point Representation:**
|
||||
- Represent a Unicode code point using the following syntax: U+XXXX, where XXXX is the hexadecimal code point.
|
||||
|
||||
Example: The code point for the letter 'A' is `U+0041`.
|
||||
|
||||
### 2. **Escape Sequences:**
|
||||
In programming languages and markup languages, Unicode characters can be represented using escape sequences. For example, `\uXXXX` in JavaScript or `\u{XXXX}` in languages like [Rust](../programming/languages/Rust.md) and JavaScript ES6.
|
||||
|
||||
Example: The escape sequence for the heart symbol (❤) is `\u2764`.
|
||||
|
||||
### 3. **UTF-8 Encoding:**
|
||||
UTF-8 is a variable-width encoding scheme that represents Unicode characters using 8-bit code units. It is widely used for its compact representation of [ASCII](ASCII.md) characters and compatibility with existing systems.
|
||||
|
||||
### 4. **UTF-16 Encoding:**
|
||||
UTF-16 uses 16-bit code units and is common in systems that work with surrogate pairs for characters outside the Basic Multilingual Plane (BMP).
|
||||
|
||||
### 5. **UTF-32 Encoding:**
|
||||
UTF-32 uses 32-bit code units for each character, providing a fixed-width encoding. It simplifies random access to characters but may consume more memory.
|
||||
|
||||
## Usage and Applications
|
||||
### 1. **Programming and Software Development:**
|
||||
- Unicode is crucial in programming for supporting a diverse set of characters in strings and text processing.
|
||||
|
||||
### 2. **Web and Document Standards:**
|
||||
- [HTML](../internet/HTML.md), [XML](XML.md), and other web standards rely on Unicode for consistent representation of text across different platforms and devices.
|
||||
|
||||
### 3. **Localization and Internationalization:**
|
||||
- Unicode facilitates the localization of software and content for different languages and regions, enabling a global audience.
|
||||
|
||||
### 4. **Operating Systems:**
|
||||
- Modern operating systems, such as [Windows](../windows/Windows.md), [macOS](../macos/macOS.md), and [Linux](../linux/Linux.md), use Unicode for character encoding, ensuring compatibility and interoperability.
|
||||
|
||||
### 5. **Communication and Social Media:**
|
||||
- Unicode is fundamental in digital communication, ensuring that users can express themselves using a wide range of symbols, emojis, and scripts.
|
32
technology/files/XML.md
Normal file
32
technology/files/XML.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
obj: concept
|
||||
---
|
||||
|
||||
# XML
|
||||
XML (Extensible Markup Language) is a markup language that is used to store and transport data. It was developed by the World Wide Web Consortium (W3C) and first released in 1998. XML is a flexible and customizable language, which allows developers to define their own tags and data structures.
|
||||
|
||||
## XML Syntax
|
||||
|
||||
XML documents are made up of elements, which are defined by a start tag, content, and an end tag. For example, here is a simple XML document:
|
||||
|
||||
```xml
|
||||
<book>
|
||||
<title>The Great Gatsby</title>
|
||||
<author>F. Scott Fitzgerald</author>
|
||||
<year>1925</year>
|
||||
</book>
|
||||
```
|
||||
|
||||
In this example, `<book>`, `<title>`, `<author>`, and `<year>` are all XML elements. The content of each element is contained between the start and end tags.
|
||||
|
||||
XML elements can also have attributes, which provide additional information about the element. For example:
|
||||
|
||||
```xml
|
||||
<book id="1234">
|
||||
<title>The Catcher in the Rye</title>
|
||||
<author>J.D. Salinger</author>
|
||||
<year>1951</year>
|
||||
</book>
|
||||
```
|
||||
|
||||
In this example, the `id` attribute is associated with the `book` element.
|
34
technology/files/XPath.md
Normal file
34
technology/files/XPath.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
obj: concept
|
||||
wiki: https://en.wikipedia.org/wiki/XPath
|
||||
---
|
||||
|
||||
# XPath
|
||||
XPath ([XML](XML.md) Path Language) is a powerful query language used to navigate and select elements from [XML](XML.md) documents. It is commonly employed in web scraping, [XML](XML.md) processing, and testing scenarios.
|
||||
|
||||
## XPath Syntax
|
||||
XPath expressions use a path notation to identify and navigate [XML](XML.md) elements. The basic syntax includes:
|
||||
- **Node Selection:** `/` is used to select the root node. `element` selects all child elements of the current node with the specified name: `/root/element`
|
||||
- **Wildcards:** The `*` symbol is used as a wildcard for any element. `/root/*`
|
||||
- **Predicates:** Square brackets `[]` are used to specify conditions for node selection. `/root/element[@attribute='value']`
|
||||
|
||||
### Absolute XPath
|
||||
Absolute XPath provides the complete path from the root node to the desired element. It starts with a single forward slash `/`.
|
||||
`/html/body/div[1]/p[2]`
|
||||
|
||||
### Relative XPath
|
||||
Relative XPath selects elements based on their relationship to other elements. It does not start from the root, allowing for more flexible and adaptable expressions.
|
||||
`//div[@class='example']/a`
|
||||
|
||||
### XPath Functions
|
||||
XPath provides various functions for more complex queries. Examples include `text()`, `contains()`, and `position()`.
|
||||
`//h2[contains(text(),'XPath')]`
|
||||
|
||||
Some functions include:
|
||||
- `text()`: The `text()` function is used to select the text content of an element.
|
||||
- `contains(element, value)`: The `contains()` function is used to check if a string contains a specific substring.
|
||||
- `starts-with(element, value)`: The `starts-with()` function is used to check if a string starts with a specified prefix.
|
||||
- `concat(elements...)`: The `concat()` function concatenates two or more strings.
|
||||
- `not(element)`: The `not()` function negates a given expression.
|
||||
- `position()`: The `position()` function returns the position of the current node in the selection.
|
||||
- `last()`: The `last()` function returns the position of the last node in the selection.
|
62
technology/files/YAML.md
Normal file
62
technology/files/YAML.md
Normal file
|
@ -0,0 +1,62 @@
|
|||
---
|
||||
obj: concept
|
||||
website: https://yaml.org
|
||||
wiki: https://en.wikipedia.org/wiki/YAML
|
||||
---
|
||||
|
||||
# YAML
|
||||
YAML is a data serialization language designed to be human-friendly and work well with modern programming languages for common everyday tasks. Additionally any valid [JSON](JSON.md) document is also a valid YAML document.
|
||||
|
||||
## Syntax
|
||||
### **Indentation:**
|
||||
Indentation is used to represent the structure of the data. Spaces or tabs can be used, but consistency is crucial.
|
||||
|
||||
### **Key-Value Pairs:**
|
||||
Data is represented as key-value pairs using a colon (`:`) to separate the key and value.
|
||||
|
||||
### **Comments:**
|
||||
Comments can be made with `#` symbol.
|
||||
|
||||
```yaml
|
||||
key: value # My Comment
|
||||
# Another comment
|
||||
```
|
||||
|
||||
### **Lists / Sequences:**
|
||||
Lists are represented using a hyphen (`-`) followed by a space.
|
||||
```yaml
|
||||
key: value
|
||||
list:
|
||||
- item1
|
||||
- item2
|
||||
```
|
||||
|
||||
### **Mappings:**
|
||||
Mappings represent key-value pairs.
|
||||
|
||||
```yaml
|
||||
key: value
|
||||
nested:
|
||||
key: value
|
||||
```
|
||||
|
||||
### Data Types
|
||||
YAML support many different data types such as strings, numbers and booleans.
|
||||
|
||||
```yaml
|
||||
mystr: "Hello World"
|
||||
mynum: 3
|
||||
myfloat: 3.1415
|
||||
mybool: true
|
||||
multiline: |
|
||||
hello world
|
||||
this is multiline
|
||||
key: value
|
||||
```
|
||||
|
||||
## Common Use Cases
|
||||
### 1. **Configuration Files:**
|
||||
YAML is widely used for configuration files in applications and systems.
|
||||
|
||||
### 3. **CI/CD Pipelines:**
|
||||
Many CI/CD tools, such as GitLab CI and [GitHub Actions](../applications/development/GitHub%20Actions.md), use YAML for defining pipelines.
|
59
technology/files/ZIP.md
Normal file
59
technology/files/ZIP.md
Normal file
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
obj: concept
|
||||
---
|
||||
|
||||
# ZIP
|
||||
Zip is a popular file compression and archiving format that allows users to store and transfer large amounts of data more efficiently. Zip files can contain one or more files or folders, which are compressed and packaged into a single archive file with the ".zip" extension.
|
||||
|
||||
Zip files use a lossless data compression algorithm that reduces the size of the files being compressed without losing any of the data. The algorithm works by finding patterns in the data and replacing them with a shorter representation. The compressed data is then stored in the zip archive file.
|
||||
|
||||
Zip files can also include encryption and password protection for added security. This feature allows users to protect their files from unauthorized access, and ensures that sensitive data remains confidential.
|
||||
|
||||
## Advantages
|
||||
|
||||
The zip file format offers several advantages, including:
|
||||
|
||||
- Efficient compression: Zip files can compress large files, reducing their size and making them easier to transfer over the internet or via email.
|
||||
- File organization: Zip files can contain multiple files and folders, which makes them an ideal format for organizing and transferring groups of related files.
|
||||
- Cross-platform compatibility: Zip files can be opened and extracted on most operating systems, including Windows, Mac, and [Linux](../linux/Linux.md).
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
zip [options] archive.zip file1 file2 folder1
|
||||
```
|
||||
|
||||
**Options:**
|
||||
- `-r`: Recursively include all files in subdirectories.
|
||||
- `-q`: Quiet mode, suppresses the output messages.
|
||||
- `-x`: Exclude specific files or folders from the archive.
|
||||
- `-P`: Set a password to protect the archive.
|
||||
- `-m`: Move the files into the archive instead of copying them.
|
||||
- `-j`: Store just the file names, without any directory information.
|
||||
- `-9`: Use maximum compression level (slower but smaller archive size).
|
||||
- `-1`: Use fastest compression level (faster but larger archive size).
|
||||
|
||||
**Examples:**
|
||||
- Create a zip file named "archive.zip" that includes all files and folders in the "myfolder" directory:
|
||||
`zip archive.zip myfolder/`
|
||||
|
||||
- Create a zip file named "myfiles.zip" that includes only the files "file1.txt" and "file2.txt":
|
||||
`zip myfiles.zip file1.txt file2.txt`
|
||||
|
||||
- Create a password-protected zip file named "secure.zip" that includes all files and folders in the "sensitive" directory:
|
||||
`zip -P password secure.zip sensitive/`
|
||||
|
||||
- Create a zip file named "docs.zip" that excludes any files with the ".jpg" extension in the "documents" directory:
|
||||
`zip -x "*.jpg" docs.zip documents/`
|
||||
|
||||
- Extract all files from the "myarchive.zip" file:
|
||||
`unzip myarchive.zip`
|
||||
|
||||
- Extract only the files "file1.txt" and "file2.txt" from the "myarchive.zip" file:
|
||||
`unzip myarchive.zip file1.txt file2.txt`
|
||||
|
||||
## Related File Formats
|
||||
Zip files are commonly used in other [file formats](File%20Formats.md) as a means of compressing and organizing data. Here are a few examples:
|
||||
- Java Archive (JAR) Files
|
||||
- OpenDocument Format (ODF) Files
|
||||
- [Android](../systems/Android.md) Application Package (APK) Files
|
||||
- [Comic Book Archive](Comic%20Book%20Archive.md)
|
Loading…
Add table
Add a link
Reference in a new issue