chromiumly
Version:
A lightweight Typescript library that interacts with Gotenberg's different modules to convert a variety of document formats to PDF files.
40 lines (39 loc) • 2.1 kB
TypeScript
import { ConversionOptions, PageProperties, PathLikeOrReadStream } from '../interfaces/libre-office.types';
/**
* Utility class for handling common tasks related to LibreOffice conversions.
*/
export declare class LibreOfficeUtils {
private static getFileInfo;
/**
* Adds files to the FormData object for LibreOffice conversion.
*
* @param {PathLikeOrReadStream[]} files - An array of files to be added to the FormData.
* @param {FormData} data - The FormData object to which files will be added.
* @throws {Error} Throws an error if the file extension is not supported.
*/
static addFiles(files: PathLikeOrReadStream[], data: FormData): Promise<void>;
/**
* Adds page properties to the FormData object based on the provided PageProperties.
*
* @param {FormData} data - The FormData object to which page properties will be added.
* @param {PageProperties} pageProperties - The page properties to be added to the FormData.
*/
static addPageProperties(data: FormData, pageProperties: PageProperties): void;
/**
* Adds files to the FormData object with a custom field name.
*
* @param {PathLikeOrReadStream[]} files - An array of files to be added to the FormData.
* @param {FormData} data - The FormData object to which files will be added.
* @param {string} fieldName - The field name to use when appending files (e.g., 'files', 'embeds').
* @returns {Promise<void>} A Promise that resolves once the files have been added.
*/
static addFilesWithFieldName(files: PathLikeOrReadStream[], data: FormData, fieldName: string): Promise<void>;
/**
* Customizes the FormData object based on the provided conversion options.
*
* @param {FormData} data - The FormData object to be customized.
* @param {ConversionOptions} options - The conversion options to apply to the FormData.
* @returns {Promise<void>} A Promise that resolves once the customization is complete.
*/
static customize(data: FormData, options: ConversionOptions): Promise<void>;
}