byteamagic
Detect MIME types and file formats from PostgreSQL bytea values
Repository
nmandery/pg_byteamagic
https://github.com/nmandery/pg_byteamagic
Source
pg_byteamagic-0.2.4.tar.gz
pg_byteamagic-0.2.4.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_byteamagic | 0.2.4 | UTIL | BSD-2-Clause | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4275 | byteamagic | No | Yes | No | Yes | No | Yes | - |
Extension name is byteamagic; package name is pg_byteamagic.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.2.4 | 1817161514 | pg_byteamagic | - |
| RPM | PIGSTY | 0.2.4 | 1817161514 | pg_byteamagic_$v | - |
| DEB | PIGSTY | 0.2.4 | 1817161514 | postgresql-$v-pg-byteamagic | - |
Build
You can build the RPM / DEB packages for pg_byteamagic using pig build:
Install
You can install pg_byteamagic directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
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.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)