DefinitelyTyped/types/ffmpeg.js/index.d.ts
Max Boguslavsky c8e9c5a677 Added typing for ffmpeg.js (#40276)
* added type for ffmpeg.js

* corrected usage

* corrected formatting

* fixed linter errors

* added fix for npm-naming error

* reverted back commit

* corrected exports

* reworked ffmpeg

* fixed according to linting errors

* fix

* declared function inside namespace; replaced back type

* rewrote package to match examples from package documentation
2019-11-19 15:46:27 -08:00

69 lines
1.5 KiB
TypeScript

// Type definitions for package ffmpeg.js 3.1
// Project: https://github.com/Kagami/ffmpeg.js
// Definitions by: Vladimir Grenaderov <https://github.com/VladimirGrenaderov>,
// Max Boguslavskiy <https://github.com/maxbogus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
declare namespace ffmpeg {
interface Options {
arguments: string[];
MEMFS?: Video[];
print?(data: any): void;
printErr?(data: any): void;
onExit?(code: unknown): void;
stdin?(data: any): void;
mounts?: Mount[];
TOTAL_MEMORY?: number;
}
interface Opts {
root: string;
}
interface Mount {
type: string;
opts: Opts;
mountpoint: string;
}
interface Result {
MEMFS: Video[];
}
interface Video {
data: Uint8Array;
name: string;
}
namespace Worker {
interface Data {
type: string;
data: string;
}
interface PostMessageOptions {
type: string;
arguments: string[];
}
interface OnMessageOptions {
data: Data;
}
}
function ffmpeg(opts: Options): Result;
class Worker {
constructor(someParam?: string);
onmessage(opts: Worker.OnMessageOptions): void;
postMessage(opts: Worker.PostMessageOptions): void;
terminate(): void;
}
}
declare function ffmpeg(opts: ffmpeg.Options): ffmpeg.Result;
export = ffmpeg;