@m4k/common 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/lib/index.d.ts +92 -0
- package/lib/index.js +11 -0
- package/package.json +18 -0
package/README.md
ADDED
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export type Progress = {
|
|
2
|
+
progress: number;
|
|
3
|
+
};
|
|
4
|
+
export type QueuePosition = {
|
|
5
|
+
position: number;
|
|
6
|
+
};
|
|
7
|
+
export type ProcessingError = {
|
|
8
|
+
error: string;
|
|
9
|
+
};
|
|
10
|
+
export type ImageOptimizerOptions = {
|
|
11
|
+
/** The rotation of the image. If not provided, the image will be auto-rotated, according to the EXIF data. To disable auto-rotation, set to `0`. */
|
|
12
|
+
rotate?: number;
|
|
13
|
+
/** Resizing options. */
|
|
14
|
+
resize?: {
|
|
15
|
+
/** The width of the image. */
|
|
16
|
+
width?: number;
|
|
17
|
+
/** The height of the image. */
|
|
18
|
+
height?: number;
|
|
19
|
+
/** The way to resize the image. */
|
|
20
|
+
fit?: "contain" | "cover" | "fill" | "inside" | "outside";
|
|
21
|
+
};
|
|
22
|
+
/** The format of the output file. */
|
|
23
|
+
format?: "avif" | "jpeg" | "png" | "webp" | "tiff" | "dz" | "ppm" | "fits" | "gif" | "svg" | "heif" | "pdf" | "jp2";
|
|
24
|
+
/** The quality of the output file. */
|
|
25
|
+
quality?: number;
|
|
26
|
+
/** Whether to keep the metadata of the image. */
|
|
27
|
+
keepMetadata?: boolean;
|
|
28
|
+
/** Whether to keep the EXIF data of the image. */
|
|
29
|
+
keepExif?: boolean;
|
|
30
|
+
/** Whether to keep the ICC profile of the image. */
|
|
31
|
+
keepIcc?: boolean;
|
|
32
|
+
/** The colorspace of the image. */
|
|
33
|
+
colorspace?: string;
|
|
34
|
+
/** The cropping options. */
|
|
35
|
+
crop?: {
|
|
36
|
+
/** The left position of the crop. */
|
|
37
|
+
left?: number;
|
|
38
|
+
/** The top position of the crop. */
|
|
39
|
+
top?: number;
|
|
40
|
+
/** The width of the crop. */
|
|
41
|
+
width: number;
|
|
42
|
+
/** The height of the crop. */
|
|
43
|
+
height: number;
|
|
44
|
+
};
|
|
45
|
+
/** The name of the output file. */
|
|
46
|
+
name?: string;
|
|
47
|
+
/** The output path of the file. */
|
|
48
|
+
output?: string;
|
|
49
|
+
};
|
|
50
|
+
export type VideoOptimizerOptions = {
|
|
51
|
+
/** The aspect ratio of the output file. */
|
|
52
|
+
aspect?: number | string;
|
|
53
|
+
/** The bitrate of the audio. */
|
|
54
|
+
audioBitrate?: number | string;
|
|
55
|
+
/** The codec of the audio. */
|
|
56
|
+
audioCodec?: string;
|
|
57
|
+
/** The filters to apply to the audio. */
|
|
58
|
+
audioFilters?: string;
|
|
59
|
+
/** The complex filters to apply to the video. */
|
|
60
|
+
complexFilters?: string;
|
|
61
|
+
/** The duration of the output file. */
|
|
62
|
+
duration?: number | string;
|
|
63
|
+
/** The format of the output file. */
|
|
64
|
+
format?: string;
|
|
65
|
+
/** The frames per second of the output file. */
|
|
66
|
+
fps?: number;
|
|
67
|
+
/** The input format of the video. */
|
|
68
|
+
inputFormat?: string;
|
|
69
|
+
/** The padding of the output file. */
|
|
70
|
+
pad?: string;
|
|
71
|
+
/** The position in the input file to start processing from. */
|
|
72
|
+
seek?: number | string;
|
|
73
|
+
/** The resolution of the output file. */
|
|
74
|
+
size?: string;
|
|
75
|
+
/** The bitrate of the video. */
|
|
76
|
+
videoBitrate?: number | string;
|
|
77
|
+
/** The codec of the video. */
|
|
78
|
+
videoCodec?: string;
|
|
79
|
+
/** The filters to apply to the video. */
|
|
80
|
+
videoFilters?: string;
|
|
81
|
+
/** The name of the output file. */
|
|
82
|
+
name?: string;
|
|
83
|
+
/** The output path of the file. */
|
|
84
|
+
output?: string;
|
|
85
|
+
};
|
|
86
|
+
export declare class ConvertedFile {
|
|
87
|
+
readonly name: string;
|
|
88
|
+
readonly type: string;
|
|
89
|
+
readonly stream?: AsyncIterable<Uint8Array> | undefined;
|
|
90
|
+
constructor(name: string, type: string, stream?: AsyncIterable<Uint8Array> | undefined);
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@m4k/common",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"types": "./lib/index.d.ts",
|
|
7
|
+
"module": "./lib/index.js",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"prepublishOnly": "bun run build",
|
|
11
|
+
"build": "tsc -b",
|
|
12
|
+
"typecheck": "tsc --noEmit"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^5.0.0"
|
|
16
|
+
},
|
|
17
|
+
"repository": "github:sv2dev/m4k"
|
|
18
|
+
}
|