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

View File

@@ -101,7 +101,7 @@ export default function ChangeSpeed({
const data = await ffmpeg.readFile(outputName);
// 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(
[blob],
file.name.replace('.mp4', `-${newSpeed}x.mp4`),

View File

@@ -53,7 +53,7 @@ export async function compressVideo(
}
const compressedData = await ffmpeg.readFile(outputName);
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`,
{ type: 'video/mp4' }
);

View File

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

View File

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

View File

@@ -71,7 +71,7 @@ export default function ChangeSpeed({ title }: ToolComponentProps) {
const data = await ffmpeg.readFile('output.gif');
// 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(
[blob],
file.name.replace('.gif', `-${newSpeed}x.gif`),

View File

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

View File

@@ -112,7 +112,7 @@ export async function mergeVideos(
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) {
console.error('Error merging videos:', error);
throw error instanceof Error

View File

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

View File

@@ -67,7 +67,7 @@ export default function TrimVideo({ title }: ToolComponentProps) {
]);
// Retrieve the processed file
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(
[trimmedBlob],
`${input.name.replace(/\.[^/.]+$/, '')}_trimmed.mp4`,

View File

@@ -98,7 +98,7 @@ export default function VideoToGif({
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, {
type: 'image/gif'
});