The next-generation file converter. Open source, fully local* and free forever.
feat: limit concurrency
not-nullptrfb42680b4072
diff --git a/bun.lock b/bun.lockindex c5265ba..d613a35 100644--- a/bun.lock+++ b/bun.lock@@ -14,6 +14,7 @@"clsx": "^2.1.1","lucide-svelte": "^0.475.0","music-metadata": "^11.0.0",+ "p-queue": "^8.1.0","vite-plugin-static-copy": "^2.2.0","wasm-vips": "^0.0.11",},@@ -400,6 +401,8 @@"esutils": ["[email protected]", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="],+ "eventemitter3": ["[email protected]", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="],+"fast-deep-equal": ["[email protected]", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="],"fast-glob": ["[email protected]", "", { "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" } }, "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg=="],@@ -568,6 +571,10 @@"p-map": ["[email protected]", "", {}, "sha512-VkndIv2fIB99swvQoA65bm+fsmt6UNdGeIB0oxBs+WhAhdh08QA04JXpI7rbB9r08/nkbysKoya9rtDERYOYMA=="],+ "p-queue": ["[email protected]", "", { "dependencies": { "eventemitter3": "^5.0.1", "p-timeout": "^6.1.2" } }, "sha512-mxLDbbGIBEXTJL0zEx8JIylaj3xQ7Z/7eEVjcF9fJX4DBiH9oqe+oahYnlKKxm0Ci9TlWTyhSHgygxMxjIB2jw=="],++ "p-timeout": ["[email protected]", "", {}, "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg=="],+"package-json-from-dist": ["[email protected]", "", {}, "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="],"parent-module": ["[email protected]", "", { "dependencies": { "callsites": "^3.0.0" } }, "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g=="],diff --git a/package.json b/package.jsonindex 5da535d..5b32c2b 100644--- a/package.json+++ b/package.json@@ -44,6 +44,7 @@"clsx": "^2.1.1","lucide-svelte": "^0.475.0","music-metadata": "^11.0.0",+ "p-queue": "^8.1.0","vite-plugin-static-copy": "^2.2.0","wasm-vips": "^0.0.11"}diff --git a/src/lib/components/functional/ConversionPanel.svelte b/src/lib/components/functional/ConversionPanel.svelteindex 767021f..173cfc3 100644--- a/src/lib/components/functional/ConversionPanel.svelte+++ b/src/lib/components/functional/ConversionPanel.svelte@@ -58,10 +58,9 @@<p class="whitespace-nowrap text-xl">Set all to</p>{#if files.requiredConverters.length === 1}<!-- cannot convert to svg or heif -->- {@const supported =- files.files[0]?.converter?.supportedFormats?.filter(- (format) => format !== ".svg" && format !== ".heif",- )}+ {@const supported = files.files[0]?.converters+ .flatMap((c) => c.supportedFormats)+ ?.filter((format) => format !== ".svg" && format !== ".heif")}<Dropdownonselect={(r) =>files.files.forEach((f) => {diff --git a/src/lib/converters/vips.svelte.ts b/src/lib/converters/vips.svelte.tsindex 47af61e..b7744a9 100644--- a/src/lib/converters/vips.svelte.ts+++ b/src/lib/converters/vips.svelte.ts@@ -33,10 +33,7 @@ export class VipsConverter extends Converter {".tif",".tiff",".jfif",- ".heif", // HEIF files that are encoded like HEIC files (and HEIC files in general) aren't supported due to https://github.com/kleisauke/wasm-vips/issues/3".avif",- ".jxl",- ".svg",];public readonly reportsProgress = false;diff --git a/src/lib/store/index.svelte.ts b/src/lib/store/index.svelte.tsindex 67682f5..aa64a95 100644--- a/src/lib/store/index.svelte.ts+++ b/src/lib/store/index.svelte.ts@@ -4,6 +4,7 @@ import { VertFile } from "$lib/types";import { parseBlob, selectCover } from "music-metadata";import { writable } from "svelte/store";import { addDialog } from "./DialogProvider";+import PQueue from "p-queue";class Files {public files = $state<VertFile[]>([]);@@ -195,7 +196,10 @@ class Files {}public async convertAll() {- await Promise.all(this.files.map((f) => f.convert()));+ const promiseFns = this.files.map((f) => () => f.convert());+ const coreCount = navigator.hardwareConcurrency || 4;+ const queue = new PQueue({ concurrency: coreCount });+ await Promise.all(promiseFns.map((fn) => queue.add(fn)));}public async downloadAll() {diff --git a/src/lib/workers/vips.ts b/src/lib/workers/vips.tsindex d0d8e8c..456d103 100644--- a/src/lib/workers/vips.ts+++ b/src/lib/workers/vips.ts@@ -1,7 +1,7 @@import Vips from "wasm-vips";const vipsPromise = Vips({- dynamicLibraries: ["vips-jxl.wasm", "vips-heif.wasm", "vips-resvg.wasm"],+ dynamicLibraries: [],});vipsPromisediff --git a/src/routes/convert/+page.svelte b/src/routes/convert/+page.svelteindex c97dc04..d7f9dcb 100644--- a/src/routes/convert/+page.svelte+++ b/src/routes/convert/+page.svelte@@ -85,6 +85,9 @@{@const isVideo = converters.find((c) => c.name === "vertd")?.supportedFormats.includes(file.from)}+ {@const isImage = converters+ .find((c) => c.name === "libvips")+ ?.supportedFormats.includes(file.from)}<Panel class="p-5 flex flex-col min-w-0 gap-4 relative"><div class="flex-shrink-0 h-8 w-full flex items-center gap-2">{#if !converters.length}@@ -146,7 +149,7 @@</p></div>{/if}- {:else if isVideo && !$vertdLoaded}+ {:else if isVideo && !isAudio && !isImage && !$vertdLoaded}<divclass="h-full flex flex-col text-center justify-center text-failure">