MCPcopy Index your code
hub / github.com/p2r3/convert / FormatHandler

Interface FormatHandler

src/FormatHandler.ts:160–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158 * Often a "wrapper" for existing tools.
159 */
160export interface FormatHandler {
161 /** Name of the tool being wrapped (e.g. "FFmpeg"). */
162 name: string;
163 /** List of supported input/output {@link FileFormat}s. */
164 supportedFormats?: FileFormat[];
165
166 /** Whether the handler supports input of any type.
167 * Conversion using this handler will be performed only if no other direct conversion is found.
168 */
169 supportAnyInput?: boolean;
170
171 /**
172 * Whether the handler is ready for use. Should be set in {@link init}.
173 * If true, {@link doConvert} is expected to work.
174 */
175 ready: boolean;
176 /**
177 * Initializes the handler if necessary.
178 * Should set {@link ready} to true.
179 */
180 init: () => Promise<void>;
181 /**
182 * Performs the actual file conversion.
183 * @param inputFiles Array of {@link FileData} entries, one per input file.
184 * @param inputFormat Input {@link FileFormat}, the same for all inputs.
185 * @param outputFormat Output {@link FileFormat}, the same for all outputs.
186 * @param args Optional arguments as a string array.
187 * Can be used to perform recursion with different settings.
188 * @returns Array of {@link FileData} entries, one per generated output file.
189 */
190 doConvert: (
191 inputFiles: FileData[],
192 inputFormat: FileFormat,
193 outputFormat: FileFormat,
194 args?: string[]
195 ) => Promise<FileData[]>;
196}
197
198export class ConvertPathNode {
199 public handler: FormatHandler;

Callers

nothing calls this directly

Implementers 15

MockedHandlertest/MockedHandler.ts
pyTurtleHandlersrc/handlers/pyTurtle.ts
mcModpackHandlersrc/handlers/mcModpack.ts
pdfparseHandlersrc/handlers/pdfparse.ts
qoaFuHandlersrc/handlers/qoa-fu.ts
azw3Handlersrc/handlers/azw3.ts
LZHHandlersrc/handlers/lzh.ts
envelopeHandlersrc/handlers/envelope.ts
jsonToCHandlersrc/handlers/jsonToC.ts
TextEncodingHandlersrc/handlers/textEncoding.ts
comicsHandlersrc/handlers/comics.ts
harHandlersrc/handlers/har.ts

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…