Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
buffered-xhr-stream
Advanced tools
A node stream that wraps xhr GET requests as a stream.
Created because the browserify node http module emits all the data as it's received, and it cannot be paused. This can cause the browser to peg the cpu if it's a large request. This module allows you to pause the stream, so it stops emitting data events. XHR responseText is buffered anyway, so when this stream is resumed, it starts emitting buffered data stored in responseText.
var XHRStream = require('buffered-xhr-stream')
, xhr = new XMLHttpRequest
xhr.open('GET', '/some-large-docs.json', true)
var stream = new XHRStream({ xhr: xhr })
, count = 0
stream.on('data', function (d) {
if (++count % 10 === 0) {
stream.pause()
}
console.log(d)
})
// or
var XHRStream = require('buffered-xhr-stream')
var stream = new XHRStream({ url: 'http://some-large-docs.json' })
, count = 0
stream.on('data', function (d) {
if (++count % 10 === 0) {
stream.pause()
}
console.log(d)
})
You can specify additional options when initializing.
When using the xhr option:
var XHRStream = require('buffered-xhr-stream')
, xhr = new XMLHttpRequest
xhr.open('GET', '/some-large-docs.json', true)
var stream = new XHRStream({ xhr: xhr, chunkSize: 2048 })
When using the url option
var XHRStream = require('buffered-xhr-stream')
var stream = new XHRStream({
url: 'http://some-large-docs.json',
method: 'GET',
contentType: 'application/json',
data: 'data passed to xhr.send()',
chunkSize: 2048
})
FAQs
A pausable/resumable xhr stream
The npm package buffered-xhr-stream receives a total of 3 weekly downloads. As such, buffered-xhr-stream popularity was classified as not popular.
We found that buffered-xhr-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.