@nottimtam/file-converter-core
v1.2.30
Published
Core file conversion modules for @nottimtam/file-converter.
Downloads
72
Maintainers
Readme
@nottimtam/file-converter-core
Core file conversion modules for @nottimtam/file-converter.
Installation
npm i @nottimtam/file-converter @nottimtam/file-converter-core
Usage
See file-converter for general implementation instructions. To implement these modules, add them to the modules array of your FileConverter
constructor:
import FileConverter from "@nottimtam/file-converter";
import CoreModules from "@nottimtam/file-converter-core";
const fileConverter = new FileConverter({
modules: [...CoreModules],
});
Modules
You can use all the modules:
import CoreModules from "@nottimtam/file-converter-core";
Or just the groups you need:
import {
ImageModules,
DocumentModules,
VideoModules,
AudioModules,
} from "@nottimtam/file-converter-core";
Do not use both CoreModules
and a sub-group at the same time, or conflict errors will be thrown.
NOTE: To use the audio/video modules, you will need to have ffmpeg
installed to the system your application is running on.
For a Dockerfile
, you can add the line:
RUN apt-get update && apt-get install -y \
ffmpeg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
If you do not want to use AudioModules
or VideoModules
, manually import the module groups you would like to use instead of using CoreModules
ImageModules
- JPEGToPNG —
image/jpeg
toimage/png
- JPEGToWebP —
image/jpeg
toimage/webp
- JPEGToGIF —
image/jpeg
toimage/gif
- JPEGToAVIF —
image/jpeg
toimage/avif
- JPEGToTIFF —
image/jpeg
toimage/tiff
- PNGToJPEG —
image/png
toimage/jpeg
- PNGToWebP —
image/png
toimage/webp
- PNGToGIF —
image/png
toimage/gif
- PNGToAVIF —
image/png
toimage/avif
- PNGToTIFF —
image/png
toimage/tiff
- WebPToPNG —
image/webp
toimage/png
- WebPToJPEG —
image/webp
toimage/jpeg
- WebPToGIF —
image/webp
toimage/gif
- WebPToAVIF —
image/webp
toimage/avif
- WebPToTIFF —
image/webp
toimage/tiff
- GIFToPNG —
image/gif
toimage/png
- GIFToWebP —
image/gif
toimage/webp
- GIFToJPEG —
image/gif
toimage/jpeg
- GIFToAVIF —
image/gif
toimage/avif
- GIFToTIFF —
image/gif
toimage/tiff
- AVIFToPNG —
image/avif
toimage/png
- AVIFToWebP —
image/avif
toimage/webp
- AVIFToGIF —
image/avif
toimage/gif
- AVIFToJPEG —
image/avif
toimage/jpeg
- AVIFToTIFF —
image/avif
toimage/tiff
- TIFFToPNG —
image/tiff
toimage/png
- TIFFToWebP —
image/tiff
toimage/webp
- TIFFToGIF —
image/tiff
toimage/gif
- TIFFToAVIF —
image/tiff
toimage/avif
- TIFFToJPEG —
image/tiff
toimage/jpeg
DocumentModules
- ImageToPDF —
image/jpeg
,image/png
toapplication/pdf
- PDFToTXT —
application/pdf
totext/plain
- PDFToHTML —
application/pdf
totext/html
- PDFToDOCX —
application/pdf
toapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
- TXTToPDF —
text/plain
toapplication/pdf
- TXTToDOCX —
text/plain
toapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
- TXTToHTML —
text/plain
totext/html
- HTMLToTXT —
text/html
totext/plain
- DOCXToTXT —
application/vnd.openxmlformats-officedocument.wordprocessingml.document
totext/plain
- DOCXToHTML —
application/vnd.openxmlformats-officedocument.wordprocessingml.document
totext/html
AudioModules
- AudioToMP3 —
audio/x-wav
,audio/x-flac
,audio/ogg
,audio/x-aiff
toaudio/mpeg
- AudioToWAV —
audio/mpeg
,audio/x-flac
,audio/ogg
,audio/x-aiff
toaudio/x-wav
- AudioToFLAC —
audio/x-wav
,audio/mpeg
,audio/ogg
,audio/x-aiff
toaudio/x-flac
- AudioToOGG —
audio/x-wav
,audio/x-flac
,audio/mpeg
,audio/x-aiff
toaudio/ogg
- AudioToAIFF —
audio/x-wav
,audio/x-flac
,audio/ogg
,audio/mpeg
toaudio/x-aiff
VideoModules
- VideoToMP4 —
video/x-msvideo
,video/x-matroska
,video/quicktime
,video/webm
,video/mpeg
,video/3gpp
tovideo/mp4
- VideoToAVI —
video/mp4
,video/x-matroska
,video/quicktime
,video/webm
,video/mpeg
,video/3gpp
tovideo/x-msvideo
- VideoToMOV —
video/x-msvideo
,video/x-matroska
,video/mp4
,video/webm
,video/mpeg
,video/3gpp
tovideo/quicktime
- VideoToWEBM —
video/x-msvideo
,video/x-matroska
,video/quicktime
,video/mp4
,video/mpeg
,video/3gpp
tovideo/webm
- VideoTo3GP —
video/x-msvideo
,video/x-matroska
,video/quicktime
,video/webm
,video/mpeg
,video/mp4
tovideo/3gpp