Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stardazed/streams-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stardazed/streams-polyfill - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

dist/sd-streams-polyfill.d.ts

4

CHANGELOG.md
# @stardazed/streams-polyfill changelog
## 1.0.6
_2018_09_19_
* Add combined TypeScript types to this package so they will be accessible when using polyfill only
## 1.0.5

@@ -4,0 +8,0 @@ _2018-09-17_

3

package.json
{
"name": "@stardazed/streams-polyfill",
"description": "Drop-in polyfill for Web Streams with fetch and encoding integration",
"version": "1.0.5",
"version": "1.0.6",
"author": {

@@ -14,2 +14,3 @@ "name": "Arthur Langereis"

"main": "dist/sd-streams-polyfill.min.js",
"types": "dist/sd-streams-polyfill.d.ts",
"scripts": {

@@ -16,0 +17,0 @@ "build": "rollup -c",

@@ -9,41 +9,4 @@ @stardazed/streams-polyfill

This uses the fully compliant [Stardazed streams](https://www.npmjs.com/package/@stardazed/streams)
and [text encoding streams](https://www.npmjs.com/package/@stardazed/streams-text-encoding)
implementations, and the [streams fetch adapter](https://www.npmjs.com/package/@stardazed/streams-fetch-adapter)
to connect the implementations to the current environment.
Download size: 11KiB gzipped, 59KiB uncompressed.
💡 **NB:** if you have your own `ReadableStream` replacement — including mocks or modifications
of the built-in type — and want to use it with `fetch`, you can use the fetch adapter
to have your code work with `fetch` transparently.
Supported Environments
----------------------
The core streams functionality requires ES6 classes, `Symbol`, `Promise` and
typed arrays to be implemented. Testing has only been done on current browsers but it
should work with Safari 9+, Edge 13+, Firefox 45+ and Chrome 42+. IE is not supported.
Adapting `fetch` to work with streams requires that the browser has native `fetch` and
`Proxy` objects. This comes down to: Safari 10.1+ (iOS 10.3+), Edge 14+, Firefox 52+
and Chrome 54+.
I have not tested older browsers with a `fetch` polyfill. It may work, it may not.
If you try it out, ensure the `fetch` polyfill loads before this one.
The text encoding streams require a compliant `TextEncoder` and `TextDecoder` to be present
either natively or through a polyfill. Browser support: Safari 10.1+, (iOS 10.3+),
Firefox 19+, Chrome 38+. Edge currently does NOT support these interfaces.
### Node
Node (as of September 2018) has no built-in fetch or web streams support. I did not do extensive
tests but this polyfill, when `require()`d, will install all streams types in Node's
`global` object and they then work as expected. Like with browsers, cooperation with any
`fetch` polyfills available has not been tested.
In general, polyfills are not used in Node. If you want to use web streams in Node, consider
using the [Stardazed streams](https://www.npmjs.com/package/@stardazed/streams)
package directly and optionally wrapping any `fetch` implementations you use with the
[streams fetch adapter](https://www.npmjs.com/package/@stardazed/streams-fetch-adapter).
Node versions >= 7 should be sufficient.
Usage

@@ -81,2 +44,16 @@ -----

⚠️ For TypeScript users, until the TS standard lib definitions fix the type constructor for
`ReadableStream`, you will get an error when providing any params to the `ReadableStream`
constructor. You will have to add a ts ignore directive on the preceding line and also
explicitly type the source object, as follows:
```ts
// @ts-ignore
const myReadable = new ReadableStream({
start(controller) {
controller.enqueue("stuff");
}
} as ReadableStreamSource);
```
API Usage

@@ -91,3 +68,44 @@ ---------

Supported Environments
----------------------
The core streams functionality requires ES6 classes, `Symbol`, `Promise` and
typed arrays to be implemented. Testing has only been done on current browsers but it
should work with Safari 9+, Edge 13+, Firefox 45+ and Chrome 42+. IE is not supported.
Adapting `fetch` to work with streams requires that the browser has native `fetch` and
`Proxy` objects. This comes down to: Safari 10.1+ (iOS 10.3+), Edge 14+, Firefox 52+
and Chrome 54+.
I have not tested older browsers with a `fetch` polyfill. It may work, it may not.
If you try it out, ensure the `fetch` polyfill loads before this one.
The text encoding streams require a compliant `TextEncoder` and `TextDecoder` to be present
either natively or through a polyfill. Browser support: Safari 10.1+, (iOS 10.3+),
Firefox 19+, Chrome 38+. Edge currently does NOT support these interfaces.
### Node
Node (as of September 2018) has no built-in fetch or web streams support. I did not do extensive
tests but this polyfill, when `require()`d, will install all streams types in Node's
`global` object and they then work as expected. Like with browsers, cooperation with any
`fetch` polyfills available has not been tested.
In general, polyfills are not used in Node. If you want to use web streams in Node, consider
using the [Stardazed streams](https://www.npmjs.com/package/@stardazed/streams)
package directly and optionally wrapping any `fetch` implementations you use with the
[streams fetch adapter](https://www.npmjs.com/package/@stardazed/streams-fetch-adapter).
Node versions >= 7 should be sufficient.
Implementation
--------------
This polyfill uses the fully compliant [Stardazed streams](https://www.npmjs.com/package/@stardazed/streams)
and [text encoding streams](https://www.npmjs.com/package/@stardazed/streams-text-encoding)
implementations, and the [streams fetch adapter](https://www.npmjs.com/package/@stardazed/streams-fetch-adapter)
to connect the implementations to the current environment.
💡 **NB:** if you have your own `ReadableStream` replacement — including mocks or modifications
of the built-in type — and want to use it with `fetch`, you can use the fetch adapter
to have your code work with `fetch` transparently.
Copyright

@@ -94,0 +112,0 @@ ---------

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc