Socket
Socket
Sign inDemoInstall

stream-to-sw

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.1.0

6

index.js

@@ -106,7 +106,5 @@ async function nextSWPostMessage () {

// if string is returned, pass it as an array of one ArrayBuffer
if (typeof asyncIterator === 'string') {
asyncIterator =
asyncIterator
.split(/(?=\n)/) // split into array of lines (regex splits without removing the newlines)
.map(line => new TextEncoder().encode(line)) // convert to Uint8Arrays
asyncIterator = [new TextEncoder().encode(asyncIterator)]
}

@@ -113,0 +111,0 @@

{
"name": "stream-to-sw",
"version": "1.0.1",
"version": "1.1.0",
"description": "intercept fetch requests with a service worker, but process the response on the main thread",

@@ -5,0 +5,0 @@ "dependencies": {

@@ -109,3 +109,3 @@ # stream-to-sw

A plain string can be also be returned from the requestHandler, and it will be automatically converted into an array of Uint8Arrays (one for each line) using [TextEncoder](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder)
A plain string can be also be returned from the requestHandler, and it will be automatically converted into an arrayBuffer using [TextEncoder](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder)

@@ -112,0 +112,0 @@ If nothing is returned, the response body is empty.

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc