Extract shared function

This commit is contained in:
Manav Rathi 2024-03-23 18:46:20 +05:30
parent bdb2a22863
commit 7704b902c4
No known key found for this signature in database
4 changed files with 2 additions and 16 deletions

View file

@ -1,10 +1,10 @@
import { addLogLine } from "@ente/shared/logging";
import { promiseWithTimeout } from "@ente/shared/promise";
import { logError } from "@ente/shared/sentry";
import { generateTempName } from "@ente/shared/utils/temp";
import { createFFmpeg, FFmpeg } from "ffmpeg-wasm";
import QueueProcessor from "services/queueProcessor";
import { getUint8ArrayView } from "services/readerService";
import { generateTempName } from "utils/temp";
const INPUT_PATH_PLACEHOLDER = "INPUT";
const FFMPEG_PLACEHOLDER = "FFMPEG";

View file

@ -1,10 +1,10 @@
import { addLogLine } from "@ente/shared/logging";
import { logError } from "@ente/shared/sentry";
import { generateTempName } from "@ente/shared/utils/temp";
import { createFFmpeg, FFmpeg } from "ffmpeg-wasm";
import QueueProcessor from "services/queueProcessor";
import { getUint8ArrayView } from "services/readerService";
import { promiseWithTimeout } from "utils/common";
import { generateTempName } from "utils/temp";
const INPUT_PATH_PLACEHOLDER = "INPUT";
const FFMPEG_PLACEHOLDER = "FFMPEG";

View file

@ -1,14 +0,0 @@
const CHARACTERS =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
export function generateTempName(length: number, suffix: string) {
let tempName = "";
const charactersLength = CHARACTERS.length;
for (let i = 0; i < length; i++) {
tempName += CHARACTERS.charAt(
Math.floor(Math.random() * charactersLength),
);
}
return `${tempName}-${suffix}`;
}