@m4k/common 0.2.0 → 0.2.3

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.
Files changed (2) hide show
  1. package/lib/index.d.ts +26 -6
  2. package/package.json +4 -2
package/lib/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export type QueuePosition = {
7
7
  export type ProcessingError = {
8
8
  error: string;
9
9
  };
10
+ type ImageFormat = "avif" | "jpeg" | "png" | "webp" | "tiff" | "dz" | "ppm" | "fits" | "gif" | "svg" | "heif" | "pdf" | "jp2";
10
11
  export type ImageOptions = {
11
12
  /** 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
13
  rotate?: number;
@@ -19,8 +20,10 @@ export type ImageOptions = {
19
20
  /** The way to resize the image. */
20
21
  fit?: "contain" | "cover" | "fill" | "inside" | "outside";
21
22
  };
23
+ /** The extension of the output file. This is the same as the format. */
24
+ ext?: ImageFormat;
22
25
  /** The format of the output file. */
23
- format?: "avif" | "jpeg" | "png" | "webp" | "tiff" | "dz" | "ppm" | "fits" | "gif" | "svg" | "heif" | "pdf" | "jp2";
26
+ format?: ImageFormat;
24
27
  /** The quality of the output file. */
25
28
  quality?: number;
26
29
  /** Whether to keep the metadata of the image. */
@@ -42,9 +45,11 @@ export type ImageOptions = {
42
45
  /** The height of the crop. */
43
46
  height: number;
44
47
  };
48
+ };
49
+ export type RemoteImageOptions = ImageOptions & {
45
50
  /** The name of the output file. */
46
51
  name?: string;
47
- /** The output path of the file. */
52
+ /** The output path of the file. This can be a local path or an S3 path. */
48
53
  output?: string;
49
54
  };
50
55
  export type VideoOptions = {
@@ -60,10 +65,14 @@ export type VideoOptions = {
60
65
  complexFilters?: string;
61
66
  /** The duration of the output file. */
62
67
  duration?: number | string;
63
- /** The format of the output file. */
68
+ /** The extension of the output file. */
69
+ ext?: string;
70
+ /** The format of the output file. If no extension is provided, it will be inferred from the format. */
64
71
  format?: string;
65
72
  /** The frames per second of the output file. */
66
73
  fps?: number;
74
+ /** The frames to process. */
75
+ frames?: number;
67
76
  /** The input format of the video. */
68
77
  inputFormat?: string;
69
78
  /** The padding of the output file. */
@@ -78,9 +87,13 @@ export type VideoOptions = {
78
87
  videoCodec?: string;
79
88
  /** The filters to apply to the video. */
80
89
  videoFilters?: string;
90
+ /** Custom ffmpeg arguments to apply to this video processing. */
91
+ args?: string[];
92
+ };
93
+ export type RemoteVideoOptions = VideoOptions & {
81
94
  /** The name of the output file. */
82
95
  name?: string;
83
- /** The output path of the file. */
96
+ /** The output path of the file. This can be a local path or an S3 path. */
84
97
  output?: string;
85
98
  };
86
99
  export type AudioOptions = {
@@ -94,15 +107,21 @@ export type AudioOptions = {
94
107
  filters?: string;
95
108
  /** The duration of the output file. */
96
109
  duration?: number | string;
97
- /** The format of the output file. */
110
+ /** The extension of the output file. */
111
+ ext?: string;
112
+ /** The format of the output file. If no extension is provided, it will be inferred from the format. */
98
113
  format?: string;
99
114
  /** The input format of the audio. */
100
115
  inputFormat?: string;
101
116
  /** The seek time of the audio. */
102
117
  seek?: number | string;
118
+ /** Custom ffmpeg arguments to apply to this audio processing. */
119
+ args?: string[];
120
+ };
121
+ export type RemoteAudioOptions = AudioOptions & {
103
122
  /** The name of the output file. */
104
123
  name?: string;
105
- /** The output path of the file. */
124
+ /** The output path of the file. This can be a local path or an S3 path. */
106
125
  output?: string;
107
126
  };
108
127
  export declare class ProcessedFile {
@@ -111,4 +130,5 @@ export declare class ProcessedFile {
111
130
  readonly stream?: AsyncIterable<Uint8Array> | undefined;
112
131
  constructor(name: string, type: string, stream?: AsyncIterable<Uint8Array> | undefined);
113
132
  }
133
+ export {};
114
134
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "@m4k/common",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "module": "./lib/index.js",
8
8
  "license": "MIT",
9
+ "description": "Common types and utilities for m4k",
10
+ "author": "sv2dev",
9
11
  "scripts": {
10
12
  "prepublishOnly": "bun run build",
11
13
  "build": "tsc -b",
12
14
  "typecheck": "tsc --noEmit"
13
15
  },
14
16
  "devDependencies": {
15
- "typescript": "^5.0.0"
17
+ "typescript": "^5.8.3"
16
18
  },
17
19
  "repository": "github:sv2dev/m4k"
18
20
  }