Socket
Socket
Sign inDemoInstall

buffered-xhr-stream

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.2 to 0.1.3

20

index.js
var stream = require('stream')
, util = require('util')
function Stream (xhr, options) {
options = options || {}
function Stream (options) {
if (!options) {
throw new Error('options are required')
}
if (!options.xhr && !options.url) {
throw new Error('options.xhr or options.url is required')
}
stream.Stream.call(this)
this.xhr = xhr
this.offset = 0

@@ -16,4 +20,10 @@ this.paused = false

this.capable = true
xhr.onreadystatechange = this.handle.bind(this)
xhr.send(null)
this.xhr = options.xhr
if (options.url) {
this.xhr = new XMLHttpRequest
this.xhr.open('GET', options.url, true)
}
this.xhr.onreadystatechange = this.handle.bind(this)
this.xhr.send(null)
}

@@ -20,0 +30,0 @@

{
"name": "buffered-xhr-stream",
"version": "0.1.2",
"version": "0.1.3",
"description": "A pausable/resumable xhr stream",

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

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