-
Notifications
You must be signed in to change notification settings - Fork 30
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
"TypeError: Failed to execute 'pipeThrough' on 'ReadableStream'" #93
Comments
No, your code is fine. Unfortunately, you ran into a limitation of the current version of the polyfill. 😞 When you load the polyfill onto the page, it replaces the existing The problem is that web APIs like I'm planning to rework the polyfill so it plays nicer together with the native <script src="https://unpkg.com/web-streams-polyfill/dist/polyfill.min.js"></script>
<script src="https://unpkg.com/@mattiasbuelens/web-streams-adapter@0.1.0/dist/web-streams-adapter.js"></script>
<script>
const toPolyfillReadable = WebStreamsAdapter.createReadableStreamWrapper(ReadableStream);
fetch(url)
.then(async res => {
const testReader = toPolyfillReadable(res.body)
.pipeThrough(DummyTransformStream())
.getReader();
// ...
});
</script> |
Hello Mattias. Thank you, I confirm that solves the issue I'd hit. That I just needed to use a related adapter for the browser's native ReadableStream makes sense. Wow, it's been a real marathon getting to the right browser-side, WHATWG web streams implementation via google search. To be honest I began this after seeing that Node recently got a WHATWG standard implementation of ReadableStream, WritableStream and TransformStream in its inbuilt API recently in v16.5 (https://nodejs.org/api/webstreams.html#webstreams_web_streams_api). I appreciate Node is a server but by googling on the same terms I kept on finding pages that suggested it could be used client side. All my misinterpretation - it's ReadableStream, not ReadableStream or ReadableStream :p Thanks for the polyfill! It suits the goals of my project well. Akira |
Glad to hear that solves your problem. And thanks for the kind words! 😄 |
👍 |
Hello.
I've not been able to use the polyfill due to encountering this error as soon as pipeThrough() is executed on the response body of a fetch().
I reduced my script down to this reproduction case. As far as I can see it really is the point where .pipeThrough() is called that the exception is thrown.
Is there a something about syntax I've made a mistake with, etc.?
The text was updated successfully, but these errors were encountered: