New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sync-fetch

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sync-fetch - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

20

browser.js

@@ -15,7 +15,12 @@ /* eslint-env browser */

let useBinaryEncoding = false
try {
// Only allowed in Worker scope, not available in older browsers
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType#Synchronous_XHR_restrictions
xhr.responseType = 'arraybuffer'
} catch (e) {
// not in Worker scope
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType#Synchronous_XHR_restrictions
// Not in Worker scope; instead, attempt this alternative method
// https://web.archive.org/web/20071103070418/http://mgran.blogspot.com/2006/08/downloading-binary-streams-with.html
xhr.overrideMimeType('text/plain; charset=x-binary')
useBinaryEncoding = true
}

@@ -33,3 +38,12 @@

const response = new syncFetch.Response(xhr.response, {
let body = xhr.response
if (useBinaryEncoding) {
const buffer = Buffer.alloc(body.length)
for (let i = 0; i < body.length; i++) {
buffer[i] = body.charCodeAt(i) & 0xff
}
body = buffer
}
const response = new syncFetch.Response(body, {
headers,

@@ -36,0 +50,0 @@ status: xhr.status,

2

package.json
{
"name": "sync-fetch",
"version": "0.4.3",
"version": "0.4.4",
"description": "Synchronous version of the Fetch API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -39,3 +39,2 @@ # sync-fetch

- (Non-spec) `timeout`
- Does not support [binary responses in the main thread](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType#Synchronous_XHR_restrictions)
- CORS limitations apply, of course (note they may be stricter for synchronous requests)

Sorry, the diff of this file is too big to display

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