Skip to content

Add support for FS.open, FS.close, FS.read, FS.write, #834

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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

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

Successfully merging this pull request may close these issues.

1 participant