@nottimtam/file-converter-core
v1.2.30
Published
Core file conversion modules for @nottimtam/file-converter.
Maintainers
Readme
@nottimtam/file-converter-core
Core file conversion modules for @nottimtam/file-converter.
Installation
npm i @nottimtam/file-converter @nottimtam/file-converter-coreUsage
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/jpegtoimage/png - JPEGToWebP —
image/jpegtoimage/webp - JPEGToGIF —
image/jpegtoimage/gif - JPEGToAVIF —
image/jpegtoimage/avif - JPEGToTIFF —
image/jpegtoimage/tiff - PNGToJPEG —
image/pngtoimage/jpeg - PNGToWebP —
image/pngtoimage/webp - PNGToGIF —
image/pngtoimage/gif - PNGToAVIF —
image/pngtoimage/avif - PNGToTIFF —
image/pngtoimage/tiff - WebPToPNG —
image/webptoimage/png - WebPToJPEG —
image/webptoimage/jpeg - WebPToGIF —
image/webptoimage/gif - WebPToAVIF —
image/webptoimage/avif - WebPToTIFF —
image/webptoimage/tiff - GIFToPNG —
image/giftoimage/png - GIFToWebP —
image/giftoimage/webp - GIFToJPEG —
image/giftoimage/jpeg - GIFToAVIF —
image/giftoimage/avif - GIFToTIFF —
image/giftoimage/tiff - AVIFToPNG —
image/aviftoimage/png - AVIFToWebP —
image/aviftoimage/webp - AVIFToGIF —
image/aviftoimage/gif - AVIFToJPEG —
image/aviftoimage/jpeg - AVIFToTIFF —
image/aviftoimage/tiff - TIFFToPNG —
image/tifftoimage/png - TIFFToWebP —
image/tifftoimage/webp - TIFFToGIF —
image/tifftoimage/gif - TIFFToAVIF —
image/tifftoimage/avif - TIFFToJPEG —
image/tifftoimage/jpeg
DocumentModules
- ImageToPDF —
image/jpeg,image/pngtoapplication/pdf - PDFToTXT —
application/pdftotext/plain - PDFToHTML —
application/pdftotext/html - PDFToDOCX —
application/pdftoapplication/vnd.openxmlformats-officedocument.wordprocessingml.document - TXTToPDF —
text/plaintoapplication/pdf - TXTToDOCX —
text/plaintoapplication/vnd.openxmlformats-officedocument.wordprocessingml.document - TXTToHTML —
text/plaintotext/html - HTMLToTXT —
text/htmltotext/plain - DOCXToTXT —
application/vnd.openxmlformats-officedocument.wordprocessingml.documenttotext/plain - DOCXToHTML —
application/vnd.openxmlformats-officedocument.wordprocessingml.documenttotext/html
AudioModules
- AudioToMP3 —
audio/x-wav,audio/x-flac,audio/ogg,audio/x-aifftoaudio/mpeg - AudioToWAV —
audio/mpeg,audio/x-flac,audio/ogg,audio/x-aifftoaudio/x-wav - AudioToFLAC —
audio/x-wav,audio/mpeg,audio/ogg,audio/x-aifftoaudio/x-flac - AudioToOGG —
audio/x-wav,audio/x-flac,audio/mpeg,audio/x-aifftoaudio/ogg - AudioToAIFF —
audio/x-wav,audio/x-flac,audio/ogg,audio/mpegtoaudio/x-aiff
VideoModules
- VideoToMP4 —
video/x-msvideo,video/x-matroska,video/quicktime,video/webm,video/mpeg,video/3gpptovideo/mp4 - VideoToAVI —
video/mp4,video/x-matroska,video/quicktime,video/webm,video/mpeg,video/3gpptovideo/x-msvideo - VideoToMOV —
video/x-msvideo,video/x-matroska,video/mp4,video/webm,video/mpeg,video/3gpptovideo/quicktime - VideoToWEBM —
video/x-msvideo,video/x-matroska,video/quicktime,video/mp4,video/mpeg,video/3gpptovideo/webm - VideoTo3GP —
video/x-msvideo,video/x-matroska,video/quicktime,video/webm,video/mpeg,video/mp4tovideo/3gpp
