Extract shared function
This commit is contained in:
parent
bdb2a22863
commit
7704b902c4
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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}`;
|
||||
}
|
Loading…
Reference in a new issue