byteamagic
byteamagic
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
|
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
|
Source
pig build pkg pg_byteamagic; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pg_byteamagic; # install via package name, for the active PG version
pig install byteamagic; # install by extension name, for the current active PG version
pig install byteamagic -v 18; # install for PG 18
pig install byteamagic -v 17; # install for PG 17
pig install byteamagic -v 16; # install for PG 16
pig install byteamagic -v 15; # install for PG 15
pig install byteamagic -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION byteamagic;Usage
Sources: GitHub repo, byteamagic docs Extension name:
byteamagicThe CSV package row ispg_byteamagic; the upstream extension name isbyteamagic.
byteamagic uses libmagic on bytea values to identify the MIME type and the file type text inside PostgreSQL.
CREATE EXTENSION byteamagic;
SELECT byteamagic_mime(data);
SELECT byteamagic_text(data);Functions
byteamagic_mime(bytea)returns the MIME type as text and matchesfile --mime-type.byteamagic_text(bytea)returns a human-readable file type description and matchesfile.
Notes
- The extension needs PostgreSQL development headers and the
libmagicdevelopment package. - It is intended for databases that store files or blobs in
byteaand need in-database type detection.
Last updated on