byteamagic
Detect MIME types and file formats from PostgreSQL bytea values
pg_byteamagic : Detect MIME types and file formats from PostgreSQL bytea values
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4275 | byteamagic | pg_byteamagic | 0.2.4 |
UTIL | BSD-2-Clause | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | external_file pgpdf omni_mimetypes fio envvar floatfile file_fdw |
Extension name is byteamagic; package name is pg_byteamagic.
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.2.4 |
18 17 16 15 14 | pg_byteamagic |
- |
| RPM | PIGSTY | 0.2.4 |
18 17 16 15 14 | pg_byteamagic_$v |
- |
| DEB | PIGSTY | 0.2.4 |
18 17 16 15 14 | postgresql-$v-pg-byteamagic |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| el8.aarch64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| el9.x86_64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| el9.aarch64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| el10.x86_64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| el10.aarch64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| d12.x86_64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| d12.aarch64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| d13.x86_64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| d13.aarch64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| u22.x86_64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| u22.aarch64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| u24.x86_64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| u24.aarch64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| u26.x86_64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
| u26.aarch64 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 | PIGSTY 0.2.4 |
Source
github.com/nmandery/pg_byteamagic
pg_byteamagic-0.2.4.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
Sources: official repo, official doc
byteamagic runs libmagic on bytea values, so PostgreSQL can identify the MIME type or human-readable file type of blobs stored in the database. The package name is pg_byteamagic, but the extension name is byteamagic.
Functions
byteamagic_mime(bytea) returns text: MIME type, equivalent tofile --mime-type.byteamagic_text(bytea) returns text: descriptive file type text, equivalent tofile.
Common Use
Caveats
- It only inspects
byteacontent; there are no operators, custom types, or extra SQL management objects. - Build/install requires PostgreSQL development headers plus the system
libmagicdevelopment package. - The upstream documentation is minimal; current user-facing behavior is unchanged from the long-standing doc page.