Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

web-sys: Add Blob.stream() method #2140

Merged
merged 1 commit into from
May 18, 2020
Merged

Conversation

str4d
Copy link
Contributor

@str4d str4d commented May 16, 2020

This enables a ReadableStream to be obtained for a file, which can then
be handled with e.g. https://github.com/MattiasBuelens/wasm-streams

let file: web_sys::File = ...;
let stream = wasm_streams::readable::ReadableStream::from(
    file.stream()
        .unchecked_into::<wasm_streams::readable::sys::ReadableStream>(),
);

WebIDL source: https://w3c.github.io/FileAPI/#blob-section
Docs: https://developer.mozilla.org/en-US/docs/Web/API/Blob/stream

This enables a ReadableStream to be obtained for a file, which can then
be handled with e.g. https://github.com/MattiasBuelens/wasm-streams

    let file: web_sys::File = ...;
    let stream = wasm_streams::readable::ReadableStream::from(
        file.stream()
            .unchecked_into::<wasm_streams::readable::sys::ReadableStream>(),
    );

WebIDL source: https://w3c.github.io/FileAPI/#blob-section
Docs: https://developer.mozilla.org/en-US/docs/Web/API/Blob/stream
@str4d str4d changed the title Add Blob.stream() method web-sys: Add Blob.stream() method May 16, 2020
@Pauan
Copy link
Contributor

Pauan commented May 16, 2020

The build failures don't seem related to this PR, it seems to be related to the recent change to rename anyref to externref.

@alexcrichton alexcrichton merged commit 6ba8c6c into rustwasm:master May 18, 2020
@alexcrichton
Copy link
Contributor

Thanks!

@str4d str4d deleted the blob-stream branch June 8, 2020 11:35
str4d added a commit to str4d/wage that referenced this pull request Jun 8, 2020
This includes rustwasm/wasm-bindgen#2140 which
we currently rely on.
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.

None yet

3 participants