@axiumine/koa-utils 6.0.0 → 7.0.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
CHANGED
|
@@ -148,11 +148,11 @@ All `throw*` helpers wrap `throwGraphQLError(status, title, description)` and yi
|
|
|
148
148
|
|
|
149
149
|
```ts
|
|
150
150
|
import { initClamScan } from '@axiumine/koa-utils/files/scanVirus'
|
|
151
|
-
import {
|
|
151
|
+
import { uploadTempImage } from '@axiumine/koa-utils/files/uploadTempImage'
|
|
152
152
|
import { uploadTempPdf } from '@axiumine/koa-utils/files/uploadTempPdf'
|
|
153
153
|
|
|
154
154
|
await initClamScan() // once at boot
|
|
155
|
-
const { tempFile, ext } = await
|
|
155
|
+
const { tempFile, ext } = await uploadTempImage(filePromise) // jpg/png → webp
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
Pipeline: stream to `/tmp` (5 MB cap) → extension + magic-number MIME check → ClamAV → sharp re-encode (strips EXIF). PDF path scans only (no re-encode).
|
|
@@ -5,4 +5,4 @@ import { IUploadTemp } from './IUploadTemp.mjs';
|
|
|
5
5
|
* @todo log uploaded file
|
|
6
6
|
* @param img
|
|
7
7
|
*/
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function uploadTempImage(img: Promise<IFileUpload>): Promise<IUploadTemp>;
|
|
@@ -8,7 +8,7 @@ import { validateJpgPngMimeType } from './validateMimeTypeImages.mjs';
|
|
|
8
8
|
* @todo log uploaded file
|
|
9
9
|
* @param img
|
|
10
10
|
*/
|
|
11
|
-
export async function
|
|
11
|
+
export async function uploadTempImage(img) {
|
|
12
12
|
let storedTempFile = '';
|
|
13
13
|
try {
|
|
14
14
|
// Step 1 - Readme.md
|