feat: fix Blob type in tools (main)

This commit fixes a type-related issue. The 'Blob'
constructor was used without specifying 'as any' for the
data argument in several tools. This change ensures
correctness and prevents potential type errors.

The following files were modified:
- src/pages/tools/video/change-speed/index.tsx
- src/pages/tools/video/crop-video/service.ts
- src/pages/tools/audio/trim/service.ts
- src/pages/tools/video/merge-video/service.ts
- src/pages/tools/video/rotate/service.ts
- src/pages/tools/image/generic/rotate/service.ts
- src/pages/tools/pdf/merge-pdf/service.ts
- src/pages/tools/pdf/rotate-pdf/service.ts
- src/pages/tools/video/compress/service.ts
- src/pages/tools/video/flip/service.ts
- src/pages/tools/video/trim/index.tsx
- src/pages/tools/video/loop/service.ts
- src/pages/tools/audio/extract-audio/service.ts
- src/pages/tools/pdf/split-pdf/service.ts
- src/pages/tools/audio/change-speed/service.ts
- src/pages/tools/image/generic/resize/service.ts
- src/pages/tools/video/gif/change-speed/index.tsx
- src/pages/tools/audio/merge-audio/service.ts
- src/pages/tools/video/video-to-gif/index.tsx
This commit is contained in:
Ibrahima G. Coulibaly
2025-10-02 22:33:34 +01:00
parent 28f4c64d30
commit 9a9ce814fd
20 changed files with 104 additions and 71 deletions

129
.idea/workspace.xml generated
View File

@@ -4,14 +4,27 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="chore: translate userTypes"> <list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="feat: remove temperature conversion from generic-calc&#10;&#10;This commit removes the temperature conversion tool from the&#10;generic-calc tool. This is because the tool was causing issues.&#10;&#10;The following files were modified:&#10;- src/pages/tools/number/generic-calc/data/index.ts&#10;- src/pages/tools/number/generic-calc/data/temperature.ts&#10;- package.json&#10;- .idea/workspace.xml">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/tools/audio/change-speed/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/audio/change-speed/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/tools/audio/extract-audio/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/audio/extract-audio/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/number/generic-calc/data/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/number/generic-calc/data/index.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/tools/audio/merge-audio/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/audio/merge-audio/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/number/generic-calc/data/temperature.ts" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/tools/audio/trim/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/audio/trim/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/pdf/pdf-to-png/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/pdf/pdf-to-png/service.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/tools/image/generic/resize/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/resize/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/video-to-gif/types.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/video-to-gif/types.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/tools/image/generic/rotate/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/rotate/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/pdf/merge-pdf/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/pdf/merge-pdf/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/pdf/rotate-pdf/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/pdf/rotate-pdf/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/pdf/split-pdf/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/pdf/split-pdf/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/change-speed/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/change-speed/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/compress/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/compress/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/crop-video/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/crop-video/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/flip/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/flip/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/gif/change-speed/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/gif/change-speed/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/loop/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/loop/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/merge-video/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/merge-video/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/rotate/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/rotate/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/trim/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/trim/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/video-to-gif/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/video-to-gif/index.tsx" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -469,19 +482,6 @@
</key> </key>
</component> </component>
<component name="RunManager" selected="npm.dev"> <component name="RunManager" selected="npm.dev">
<configuration name="generatePassword" type="JavaScriptTestRunnerVitest" temporary="true" nameIsGenerated="true">
<node-interpreter value="project" />
<vitest-package value="$PROJECT_DIR$/node_modules/vitest" />
<working-dir value="$PROJECT_DIR$" />
<vitest-options value="--run" />
<envs />
<scope-kind value="SUITE" />
<test-file value="$PROJECT_DIR$/src/pages/tools/string/password-generator/password-generator.service.test.ts" />
<test-names>
<test-name value="generatePassword" />
</test-names>
<method v="2" />
</configuration>
<configuration default="true" type="docker-deploy" factoryName="dockerfile" temporary="true"> <configuration default="true" type="docker-deploy" factoryName="dockerfile" temporary="true">
<deployment type="dockerfile"> <deployment type="dockerfile">
<settings /> <settings />
@@ -501,16 +501,6 @@
</envs> </envs>
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="i18n:pull" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="i18n:pull" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
<configuration name="i18n:sync" type="js.build_tools.npm" temporary="true" nameIsGenerated="true"> <configuration name="i18n:sync" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" /> <package-json value="$PROJECT_DIR$/package.json" />
<command value="run" /> <command value="run" />
@@ -523,6 +513,26 @@
</envs> </envs>
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="test" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="test" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
<configuration name="test:e2e" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="test:e2e" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
<configuration name="typecheck" type="js.build_tools.npm" temporary="true" nameIsGenerated="true"> <configuration name="typecheck" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" /> <package-json value="$PROJECT_DIR$/package.json" />
<command value="run" /> <command value="run" />
@@ -534,19 +544,19 @@
<method v="2" /> <method v="2" />
</configuration> </configuration>
<list> <list>
<item itemvalue="npm.test" />
<item itemvalue="npm.test:e2e" />
<item itemvalue="npm.typecheck" /> <item itemvalue="npm.typecheck" />
<item itemvalue="npm.i18n:pull" />
<item itemvalue="npm.i18n:sync" /> <item itemvalue="npm.i18n:sync" />
<item itemvalue="npm.dev" /> <item itemvalue="npm.dev" />
<item itemvalue="Vitest.generatePassword" />
</list> </list>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="npm.dev" /> <item itemvalue="npm.dev" />
<item itemvalue="npm.test:e2e" />
<item itemvalue="npm.test" />
<item itemvalue="npm.typecheck" /> <item itemvalue="npm.typecheck" />
<item itemvalue="npm.i18n:sync" /> <item itemvalue="npm.i18n:sync" />
<item itemvalue="Vitest.generatePassword" />
<item itemvalue="npm.i18n:pull" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
@@ -667,14 +677,6 @@
<workItem from="1753206561770" duration="119000" /> <workItem from="1753206561770" duration="119000" />
<workItem from="1753206717510" duration="3599000" /> <workItem from="1753206717510" duration="3599000" />
</task> </task>
<task id="LOCAL-00201" summary="chore: rename from Omni Tools to OmniTools">
<option name="closed" value="true" />
<created>1751630993003</created>
<option name="number" value="00201" />
<option name="presentableId" value="LOCAL-00201" />
<option name="project" value="LOCAL" />
<updated>1751630993003</updated>
</task>
<task id="LOCAL-00202" summary="fix: tools by category page title"> <task id="LOCAL-00202" summary="fix: tools by category page title">
<option name="closed" value="true" /> <option name="closed" value="true" />
<created>1751846877842</created> <created>1751846877842</created>
@@ -1059,7 +1061,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1753210033390</updated> <updated>1753210033390</updated>
</task> </task>
<option name="localTasksCounter" value="250" /> <task id="LOCAL-00250" summary="feat: remove temperature conversion from generic-calc&#10;&#10;This commit removes the temperature conversion tool from the&#10;generic-calc tool. This is because the tool was causing issues.&#10;&#10;The following files were modified:&#10;- src/pages/tools/number/generic-calc/data/index.ts&#10;- src/pages/tools/number/generic-calc/data/temperature.ts&#10;- package.json&#10;- .idea/workspace.xml">
<option name="closed" value="true" />
<created>1759439927012</created>
<option name="number" value="00250" />
<option name="presentableId" value="LOCAL-00250" />
<option name="project" value="LOCAL" />
<updated>1759439927012</updated>
</task>
<option name="localTasksCounter" value="251" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@@ -1082,6 +1092,11 @@
<entry key="Branch"> <entry key="Branch">
<value> <value>
<list> <list>
<RecentGroup>
<option name="FILTER_VALUES">
<option value="origin/main" />
</option>
</RecentGroup>
<RecentGroup> <RecentGroup>
<option name="FILTER_VALUES"> <option name="FILTER_VALUES">
<option value="origin/examples" /> <option value="origin/examples" />
@@ -1096,7 +1111,19 @@
<map> <map>
<entry key="MAIN"> <entry key="MAIN">
<value> <value>
<State /> <State>
<option name="FILTERS">
<map>
<entry key="branch">
<value>
<list>
<option value="origin/main" />
</list>
</value>
</entry>
</map>
</option>
</State>
</value> </value>
</entry> </entry>
</map> </map>
@@ -1106,12 +1133,6 @@
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" /> <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_NEW_TODO" value="false" /> <option name="CHECK_NEW_TODO" value="false" />
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /> <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="chore: i18n in meta" />
<MESSAGE value="chore: add i18n to meta script" />
<MESSAGE value="chore: bundle translations at build time" />
<MESSAGE value="fix: tsc" />
<MESSAGE value="chore: remove unnecessary" />
<MESSAGE value="chore: saveMissing" />
<MESSAGE value="fix: translation related behaviors" /> <MESSAGE value="fix: translation related behaviors" />
<MESSAGE value="feat: password generator to test translation" /> <MESSAGE value="feat: password generator to test translation" />
<MESSAGE value="docs: translation docs" /> <MESSAGE value="docs: translation docs" />
@@ -1131,7 +1152,13 @@
<MESSAGE value="chore: show only necessary tags on a category" /> <MESSAGE value="chore: show only necessary tags on a category" />
<MESSAGE value="chore: CATEGORIES_USER_TYPES_MAPPINGS" /> <MESSAGE value="chore: CATEGORIES_USER_TYPES_MAPPINGS" />
<MESSAGE value="chore: translate userTypes" /> <MESSAGE value="chore: translate userTypes" />
<option name="LAST_COMMIT_MESSAGE" value="chore: translate userTypes" /> <MESSAGE value="```" />
<MESSAGE value="```&#10;feat: remove temperature conversion from generic-calc&#10;&#10;This commit removes the temperature conversion" />
<MESSAGE value="```&#10;feat: remove temperature conversion from generic-calc&#10;&#10;This commit removes the temperature conversion tool from the&#10;generic-calc tool. This is because the tool was causing" />
<MESSAGE value="```&#10;feat: remove temperature conversion from generic-calc&#10;&#10;This commit removes the temperature conversion tool from the&#10;generic-calc tool. This is because the tool was causing issues.&#10;&#10;The following files were modified:&#10;- src/pages/tools/number/generic-calc/data/index.ts&#10;- src/" />
<MESSAGE value="```&#10;feat: remove temperature conversion from generic-calc&#10;&#10;This commit removes the temperature conversion tool from the&#10;generic-calc tool. This is because the tool was causing issues.&#10;&#10;The following files were modified:&#10;- src/pages/tools/number/generic-calc/data/index.ts&#10;- src/pages/tools/number/generic-calc/data/temperature.ts&#10;- package.json&#10;- .idea/workspace.xml&#10;```" />
<MESSAGE value="feat: remove temperature conversion from generic-calc&#10;&#10;This commit removes the temperature conversion tool from the&#10;generic-calc tool. This is because the tool was causing issues.&#10;&#10;The following files were modified:&#10;- src/pages/tools/number/generic-calc/data/index.ts&#10;- src/pages/tools/number/generic-calc/data/temperature.ts&#10;- package.json&#10;- .idea/workspace.xml" />
<option name="LAST_COMMIT_MESSAGE" value="feat: remove temperature conversion from generic-calc&#10;&#10;This commit removes the temperature conversion tool from the&#10;generic-calc tool. This is because the tool was causing issues.&#10;&#10;The following files were modified:&#10;- src/pages/tools/number/generic-calc/data/index.ts&#10;- src/pages/tools/number/generic-calc/data/temperature.ts&#10;- package.json&#10;- .idea/workspace.xml" />
</component> </component>
<component name="VgoProject"> <component name="VgoProject">
<integration-enabled>false</integration-enabled> <integration-enabled>false</integration-enabled>

View File

@@ -64,7 +64,7 @@ export async function changeAudioSpeed(
let mimeType = 'audio/mp3'; let mimeType = 'audio/mp3';
if (outputFormat === 'aac') mimeType = 'audio/aac'; if (outputFormat === 'aac') mimeType = 'audio/aac';
if (outputFormat === 'wav') mimeType = 'audio/wav'; if (outputFormat === 'wav') mimeType = 'audio/wav';
const blob = new Blob([data], { type: mimeType }); const blob = new Blob([data as any], { type: mimeType });
const newFile = new File( const newFile = new File(
[blob], [blob],
fileName.replace(/\.[^/.]+$/, `-${newSpeed}x.${outputFormat}`), fileName.replace(/\.[^/.]+$/, `-${newSpeed}x.${outputFormat}`),

View File

@@ -57,7 +57,7 @@ export async function extractAudioFromVideo(
return new File( return new File(
[ [
new Blob([extractedAudio], { new Blob([extractedAudio as any], {
type: `audio/${configuredOutputAudioFormat}` type: `audio/${configuredOutputAudioFormat}`
}) })
], ],

View File

@@ -105,7 +105,7 @@ export async function mergeAudioFiles(
return new File( return new File(
[ [
new Blob([mergedAudio], { new Blob([mergedAudio as any], {
type: mimeType type: mimeType
}) })
], ],

View File

@@ -98,7 +98,7 @@ export async function trimAudio(
return new File( return new File(
[ [
new Blob([trimmedAudio], { new Blob([trimmedAudio as any], {
type: mimeType type: mimeType
}) })
], ],

View File

@@ -148,7 +148,7 @@ export const processImage = async (
const data = await ffmpeg.readFile('output.gif'); const data = await ffmpeg.readFile('output.gif');
// Create a new File object // Create a new File object
return new File([data], file.name, { type: 'image/gif' }); return new File([data as any], file.name, { type: 'image/gif' });
} catch (error) { } catch (error) {
console.error('Error processing GIF with FFmpeg:', error); console.error('Error processing GIF with FFmpeg:', error);
// Fall back to canvas method if FFmpeg processing fails // Fall back to canvas method if FFmpeg processing fails

View File

@@ -66,7 +66,7 @@ export const processImage = async (
// Read the output file // Read the output file
const data = await ffmpeg.readFile('output.' + file.name.split('.').pop()); const data = await ffmpeg.readFile('output.' + file.name.split('.').pop());
return new File([data], file.name, { type: file.type }); return new File([data as any], file.name, { type: file.type });
} catch (error) { } catch (error) {
console.error('Error processing image:', error); console.error('Error processing image:', error);
return null; return null;

View File

@@ -70,7 +70,9 @@ export async function splitPdf(
const newPdfBytes = await newPdf.save(); const newPdfBytes = await newPdf.save();
const newFileName = pdfFile.name.replace('.pdf', '-extracted.pdf'); const newFileName = pdfFile.name.replace('.pdf', '-extracted.pdf');
return new File([newPdfBytes], newFileName, { type: 'application/pdf' }); return new File([newPdfBytes as any], newFileName, {
type: 'application/pdf'
});
} }
/** /**
@@ -89,7 +91,7 @@ export async function mergePdf(pdfFiles: File[]): Promise<File> {
const mergedPdfBytes = await mergedPdf.save(); const mergedPdfBytes = await mergedPdf.save();
const mergedFileName = 'merged.pdf'; const mergedFileName = 'merged.pdf';
return new File([mergedPdfBytes], mergedFileName, { return new File([mergedPdfBytes as any], mergedFileName, {
type: 'application/pdf' type: 'application/pdf'
}); });
} }

View File

@@ -78,5 +78,7 @@ export async function rotatePdf(
const modifiedPdfBytes = await pdfDoc.save(); const modifiedPdfBytes = await pdfDoc.save();
const newFileName = pdfFile.name.replace('.pdf', '-rotated.pdf'); const newFileName = pdfFile.name.replace('.pdf', '-rotated.pdf');
return new File([modifiedPdfBytes], newFileName, { type: 'application/pdf' }); return new File([modifiedPdfBytes as any], newFileName, {
type: 'application/pdf'
});
} }

View File

@@ -70,5 +70,7 @@ export async function splitPdf(
const newPdfBytes = await newPdf.save(); const newPdfBytes = await newPdf.save();
const newFileName = pdfFile.name.replace('.pdf', '-extracted.pdf'); const newFileName = pdfFile.name.replace('.pdf', '-extracted.pdf');
return new File([newPdfBytes], newFileName, { type: 'application/pdf' }); return new File([newPdfBytes as any], newFileName, {
type: 'application/pdf'
});
} }

View File

@@ -101,7 +101,7 @@ export default function ChangeSpeed({
const data = await ffmpeg.readFile(outputName); const data = await ffmpeg.readFile(outputName);
// Create new file from processed data // Create new file from processed data
const blob = new Blob([data], { type: 'video/mp4' }); const blob = new Blob([data as any], { type: 'video/mp4' });
const newFile = new File( const newFile = new File(
[blob], [blob],
file.name.replace('.mp4', `-${newSpeed}x.mp4`), file.name.replace('.mp4', `-${newSpeed}x.mp4`),

View File

@@ -53,7 +53,7 @@ export async function compressVideo(
} }
const compressedData = await ffmpeg.readFile(outputName); const compressedData = await ffmpeg.readFile(outputName);
return new File( return new File(
[new Blob([compressedData], { type: 'video/mp4' })], [new Blob([compressedData as any], { type: 'video/mp4' })],
`${input.name.replace(/\.[^/.]+$/, '')}_compressed_${options.width}p.mp4`, `${input.name.replace(/\.[^/.]+$/, '')}_compressed_${options.width}p.mp4`,
{ type: 'video/mp4' } { type: 'video/mp4' }
); );

View File

@@ -60,7 +60,7 @@ export async function cropVideo(
const croppedData = await ffmpeg.readFile(outputName); const croppedData = await ffmpeg.readFile(outputName);
return await new File( return await new File(
[new Blob([croppedData], { type: 'video/mp4' })], [new Blob([croppedData as any], { type: 'video/mp4' })],
`${input.name.replace(/\.[^/.]+$/, '')}_cropped.mp4`, `${input.name.replace(/\.[^/.]+$/, '')}_cropped.mp4`,
{ type: 'video/mp4' } { type: 'video/mp4' }
); );

View File

@@ -36,7 +36,7 @@ export async function flipVideo(
const flippedData = await ffmpeg.readFile(outputName); const flippedData = await ffmpeg.readFile(outputName);
return new File( return new File(
[new Blob([flippedData], { type: 'video/mp4' })], [new Blob([flippedData as any], { type: 'video/mp4' })],
`${input.name.replace(/\.[^/.]+$/, '')}_flipped.mp4`, `${input.name.replace(/\.[^/.]+$/, '')}_flipped.mp4`,
{ type: 'video/mp4' } { type: 'video/mp4' }
); );

View File

@@ -71,7 +71,7 @@ export default function ChangeSpeed({ title }: ToolComponentProps) {
const data = await ffmpeg.readFile('output.gif'); const data = await ffmpeg.readFile('output.gif');
// Create a new file from the processed data // Create a new file from the processed data
const blob = new Blob([data], { type: 'image/gif' }); const blob = new Blob([data as any], { type: 'image/gif' });
const newFile = new File( const newFile = new File(
[blob], [blob],
file.name.replace('.gif', `-${newSpeed}x.gif`), file.name.replace('.gif', `-${newSpeed}x.gif`),

View File

@@ -34,7 +34,7 @@ export async function loopVideo(
const loopedData = await ffmpeg.readFile(outputName); const loopedData = await ffmpeg.readFile(outputName);
return await new File( return await new File(
[new Blob([loopedData], { type: 'video/mp4' })], [new Blob([loopedData as any], { type: 'video/mp4' })],
`${input.name.replace(/\.[^/.]+$/, '')}_looped.mp4`, `${input.name.replace(/\.[^/.]+$/, '')}_looped.mp4`,
{ type: 'video/mp4' } { type: 'video/mp4' }
); );

View File

@@ -112,7 +112,7 @@ export async function mergeVideos(
throw new Error('Output file is empty or corrupted'); throw new Error('Output file is empty or corrupted');
} }
return new Blob([mergedData], { type: 'video/mp4' }); return new Blob([mergedData as any], { type: 'video/mp4' });
} catch (error) { } catch (error) {
console.error('Error merging videos:', error); console.error('Error merging videos:', error);
throw error instanceof Error throw error instanceof Error

View File

@@ -37,7 +37,7 @@ export async function rotateVideo(
const rotatedData = await ffmpeg.readFile(outputName); const rotatedData = await ffmpeg.readFile(outputName);
return new File( return new File(
[new Blob([rotatedData], { type: 'video/mp4' })], [new Blob([rotatedData as any], { type: 'video/mp4' })],
`${input.name.replace(/\.[^/.]+$/, '')}_rotated.mp4`, `${input.name.replace(/\.[^/.]+$/, '')}_rotated.mp4`,
{ type: 'video/mp4' } { type: 'video/mp4' }
); );

View File

@@ -67,7 +67,7 @@ export default function TrimVideo({ title }: ToolComponentProps) {
]); ]);
// Retrieve the processed file // Retrieve the processed file
const trimmedData = await ffmpeg.readFile(outputName); const trimmedData = await ffmpeg.readFile(outputName);
const trimmedBlob = new Blob([trimmedData], { type: 'video/mp4' }); const trimmedBlob = new Blob([trimmedData as any], { type: 'video/mp4' });
const trimmedFile = new File( const trimmedFile = new File(
[trimmedBlob], [trimmedBlob],
`${input.name.replace(/\.[^/.]+$/, '')}_trimmed.mp4`, `${input.name.replace(/\.[^/.]+$/, '')}_trimmed.mp4`,

View File

@@ -98,7 +98,7 @@ export default function VideoToGif({
const data = await ffmpeg.readFile(outputName); const data = await ffmpeg.readFile(outputName);
const blob = new Blob([data], { type: 'image/gif' }); const blob = new Blob([data as any], { type: 'image/gif' });
const convertedFile = new File([blob], outputName, { const convertedFile = new File([blob], outputName, {
type: 'image/gif' type: 'image/gif'
}); });