Complete basic rewrite

This commit is contained in:
Jerome Wu
2022-09-30 17:21:03 +08:00
parent 2f18a2d806
commit a136b8b1bb
39 changed files with 3586 additions and 8769 deletions

View File

@@ -0,0 +1,38 @@
{
"name": "@ffmpeg/types",
"version": "0.11.5",
"description": "ffmpeg.wasm types",
"types": "types",
"scripts": {
"lint": "dtslint types"
},
"files": [
"types"
],
"repository": {
"type": "git",
"url": "git+https://github.com/ffmpegwasm/ffmpeg.wasm.git"
},
"keywords": [
"ffmpeg",
"WebAssembly",
"video",
"audio",
"transcode"
],
"author": "Jerome Wu <jeromewus@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/ffmpegwasm/ffmpeg.wasm/issues"
},
"engines": {
"node": ">=16.6.0"
},
"homepage": "https://github.com/ffmpegwasm/ffmpeg.wasm#readme",
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@definitelytyped/dtslint": "^0.0.133"
}
}

39
packages/types/types/index.d.ts vendored Normal file
View File

@@ -0,0 +1,39 @@
export type Pointer = number;
export type StringPointer = Pointer;
export type StringArrayPointer = Pointer;
export interface FS {
mkdir: (fileName: string) => void;
readFile: (fileName: string) => Uint8Array;
readdir: (pathName: string) => string[];
unlink: (fileName: string) => void;
writeFile: (fileName: string, binaryData: Uint8Array | string) => void;
}
export interface Log {
type: string;
message: string;
}
export interface FFmpegCoreModule {
DEFAULT_ARGS: string[];
FS: FS;
NULL: Pointer;
SIZE_I32: number;
ret: number;
timeout: number;
mainScriptUrlOrBlob: string;
exec: (...args: string[]) => number;
reset: () => void;
setLogger: (logger: (log: Log) => void) => void;
setTimeout: (timeout: number) => void;
setProgress: (handler: (progress: number) => void) => void;
locateFile: (path: string, prefix: string) => string;
}
export type FFmpegCoreModuleFactory = (
moduleOverrides?: Partial<FFmpegCoreModule>
) => Promise<FFmpegCoreModule>;

View File

@@ -0,0 +1,18 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
// If the library is an external module (uses `export`), this allows your test file to import "mylib" instead of "./index".
// If the library is global (cannot be imported via `import` or `require`), leave this out.
"baseUrl": ".",
"paths": { "@ffmpeg/types": ["."] }
}
}