Skip to content

Conversation

animeshxd
Copy link

Added read and write methods for handling large file
Here is the example

async function download(url, path) {
    let fd;
    try {
        fd = await ffmpeg.open(path, 'w')
        const resp = await fetch(url);
        const reader = resp.body.getReader();
        while (true) {
            const { done, value } = await reader.read();
            if (done) break;
            await ffmpeg.write(fd, value, 0, value.length)
        }
    }
    finally {
        await ffmpeg.close(fd)
    }
}

Copy link

netlify bot commented Feb 2, 2025

Deploy Preview for ffmpegwasm canceled.

Name Link
🔨 Latest commit 4443577
🔍 Latest deploy log https://app.netlify.com/sites/ffmpegwasm/deploys/679f6858cf498e0008b4bd3a

@animeshxd
Copy link
Author

animeshxd commented Sep 28, 2025

open and close name is kinna weird 😫, openFile, closeFile would be better or maybe FS namespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant