wasm-imagemagick
Version:
Webassembly compilation of ImageMagick
56 lines (55 loc) • 2.08 kB
TypeScript
/**
* Base class for ImageMagick input and output files.
*/
export interface MagickFile {
name: string;
}
/**
* Represents output files generated when an ImageMagick command executes.
*/
export interface MagickOutputFile extends MagickFile {
blob: Blob;
buffer?: ArrayBuffer;
}
/**
* Represents input files that need to be provided to {@link call} or [execute](https://github.com/KnicKnic/WASM-ImageMagick/tree/master/apidocs#execute).
*
* Can be builded using {@link buildInputFile}
*/
export interface MagickInputFile extends MagickFile {
content: Uint8Array;
}
/**
* {@link call} shortcut that only returns the output files.
*/
export declare function Call(inputFiles: MagickInputFile[], command: string[]): Promise<MagickOutputFile[]>;
/**
* The result of calling {@link call}. Also the base class of results of calling [execute](https://github.com/KnicKnic/WASM-ImageMagick/tree/master/apidocs#execute).
*/
export interface CallResult {
/**
* Output files generated by the command, if any
*/
outputFiles: MagickOutputFile[];
/**
* Output printed by the command to stdout. For example the command `identify rose:` will print useful information to stdout
*/
stdout: string[];
/**
* Output printed by the command to stderr. If `exitCode != 0` then this property could have some information about the error.
*/
stderr: string[];
/**
* Exit code of the command executed. If 0 the command executed successfully, otherwise an error occurred and `stderr` could have some information about what was wrong
*/
exitCode: number;
}
/**
* Low level execution function. All the other functions like [execute](https://github.com/KnicKnic/WASM-ImageMagick/tree/master/apidocs#execute)
* ends up calling this one. It accept only one command and only in the form of array of strings.
*/
export declare function call(inputFiles: MagickInputFile[], command: string[]): Promise<CallResult>;
export declare function CreatePromiseEvent(): Promise<{}> & {
resolve?: any;
reject?: any;
};