ce-util/readme.md
2024-06-12 11:09:09 +02:00

90 lines
3.8 KiB
Markdown

# 🗄️ Cute Engineering Uniform Type Identifier Library
Common uniform type identifier.
## What are UTIs?
Uniform Type Identifiers (UTIs) are a type of identifier used identify the type of a ressource in a computer system. UTIs are hierarchical, meaning that they can be related to each other in a parent-child relationship. For example, the UTI for a JPEG image is `public.jpeg`, and the UTI for a PNG image is `public.png`. The `public.image` UTI is the parent of both `public.jpeg` and `public.png`.
## Why use UTIs?
UTIs are more flexible than file extensions, and can be used to identify any type of ressource, not just files. UTIs can also be used to identify ressources that don't have a file extension, or that have a non-standard file extension.
## How to use UTIs?
UTIs are strings that follow a specific format. The format of a UTI is a series of components separated by dots. Each component is a string that represents a category of ressource. For example, the UTI for a JPEG image is `public.jpeg`, which consists of two components: `public` and `jpeg`.
## Examples
- `public.jpeg`: JPEG image
- `public.png`: PNG image
- `public.audio`: Audio file
- `public.video`: Video file
- `public.text`: Text file
## Relationship with Apple's UTIs
While inspired by Apple's UTIs, this specification is its own thing and is not affiliated with Apple in any way. The goal of this specification is to provide a common set of UTIs that can be used across different platforms and programming languages.
## Format
The format of a UTI is a series of components separated by dots. Each component is a string that represents a category of ressource. For example, the UTI for a JPEG image is `public.jpeg`, which consists of two components: `public` and `jpeg`.
## Namespaces
UTIs are divided into namespaces, which are used to group related UTIs together. Common namespaces include `public`, `vendor`, `private`, and `local`.
- `public`: UTIs that are intended to be used by everyone.
- `vendor`: UTIs that are intended to be used by a specific vendor.
- `private`: UTIs that are intended to be used by a specific application.
- `local`: UTIs that are intended to be used by a specific user/computer.
### The `local` Namespace
The `local` namespace is intended to be used for UTIs that are specific to a particular system or user, and that may not be applicable to other systems or users. For example a UTI for the user's device `local.device` could conform to `public.device.mobile` or `public.device.desktop` depending on the device type.
## Declaration
A UTI is declared as JSON object following the `https://schemas.cute.engineering/stable/common.uti.v1` schema.
```json
{
"$schema": "https://schemas.cute.engineering/stable/common.uti.v1",
"exports": [
{
"id": "public.jpeg",
"description": "JPEG image",
"conforms": [
"public.image"
],
"references": [
"https://en.wikipedia.org/wiki/JPEG"
],
"specifications": [
".jpg",
".jpeg",
".jpe",
"image/jpeg",
"image/jpg"
]
}
]
}
```
## Contributing
Contributions are welcome! If you have a UTI that you would like to add, please open a pull request. Please make sure to follow the format of existing UTIs, and to provide a description of the UTI and its intended use.
## License
<a href="https://opensource.org/licenses/MIT">
<img align="right" height="96" alt="MIT License" src="https://branding.cute.engineering/licenses/mit.svg" />
</a>
This software projet is licensed under the **MIT License**.
The full text of the license can be accessed via [this link](https://opensource.org/licenses/MIT) and is also included in the [license.md](license.md) file of this software package.