@eternaljs/base64-info
v1.1.0
Published
Enhance base64 workflows. Swiftly retrieve type, extension, and content info. Simplify binary data management for smoother project integration.
Downloads
41
Maintainers
Readme
Base64 Info
The base64-info npm package is a lightweight and efficient utility that simplifies working with base64 encoded strings by providing convenient methods to extract crucial details. With this package, you can effortlessly determine the type, extension, and content of base64 strings, making it an essential tool for developers dealing with binary data conversions.
Key Features:
Type Detection: Easily identify the type of data represented by a base64 string, whether it's an image, audio, video, or other file formats.
Extension Inference: Automatically infer the file extension associated with the base64 content, ensuring accurate representation when decoding or processing the data.
Content Extraction: Retrieve the binary content from a base64 string, enabling seamless integration with various data manipulation workflows.
Efficient Performance: Designed for optimal performance, base64-info provides quick and reliable results, suitable for both small and large-scale applications.
Whether you're building applications that involve image uploading, multimedia handling, or file conversion, base64-info streamlines the process of working with base64 encoded data, allowing you to focus on delivering robust and feature-rich applications.
Installing
Using npm:
$ npm install @eternaljs/base64-info
Using yarn:
$ yarn add @eternaljs/base64-info
Imports
// JavaScript
const { getBase64Info } = require("@eternaljs/base64-info");
// TypeScript
import { getBase64Info } from "@eternaljs/base64-info";
Usage
These examples assume you're in node, or something similar:
const base64Details = getBase64Info(base64String);
// Log
console.log(base64Details);
// Output
{
"name": "JPEG",
"type": "image/jpeg",
"sign": "/9j/4AAQSk",
"extension": "jpeg",
"content": "data:image/jpeg;base64",
"category": "image",
"base64": "/9j/4AAQSkZJRgABAQEASABIAAD"
}
Supported files extension
jpeg
,
jpg
,
png
,
jfif
,
gif
,
webp
,
xcf
,
bmp
,
cur
,
dds
,
exr
,
fts
,
hdr
,
ico
,
jpe
,
jps
,
mng
,
pam
,
pbm
,
pcd
,
pcx
,
pgm
,
picon
,
pict
,
pnm
,
ppm
,
psd
,
ras
,
sgi
,
svg
,
tga
,
tiff
,
wbmp
,
xbm
,
xpm
,
xwd
,
erf
,
heic
,
jp2
,
pes
,
pfm
,
heif
,
swf
,
dng
,
orf
,
X3F
,
nrw
,
rw2
,
nef
,
pef
,
raf
,
cr2
,
xlsx
,
xls
,
txt
,
ott
,
odt
,
ods
,
odp
,
djvu
,
doc
,
csv
,
ppt
,
rtf
,
docx
,
pdf
,
cvsd
,
cvu
,
gsrt
,
hcom
,
m4a
,
mp3
,
ogg
,
opus
,
prc
,
sln
,
spx
,
txw
,
vms
,
wve
,
cvs
,
dvms
,
m4r
,
wma
,
ima
,
ra
,
vox
,
aac
,
sndr
,
sndt
,
ac3
,
8svx
,
fssd
,
htk
,
smp
,
sou
,
aiff
,
flac
,
oga
,
tta
,
wv
,
sd2
,
amb
,
au
,
avr
,
caf
,
cdda
,
dts
,
fap
,
ircam
,
maud
,
nist
,
paf
,
pvf
,
snd
,
sph
,
voc
,
w64
,
wav
,
bat
,
htaccess
,
json
,
kml
,
sql
,
c
,
cpp
,
cs
,
css
,
go
,
h
,
java
,
pl
,
py
,
rb
,
sh
,
html
,
html
,
swift
,
test
,
vb
,
yaml
,
class
,
js
,
snb
,
pdb
,
mobi
,
lrf
,
fb2
,
epub
,
azw3
,
woff
,
ttf
,
sfd
,
ps
,
pfb
,
otf
,
bin
,
dfont
,
cff
License
MIT