This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/stream-http/test/browser/lib/webworker-worker.js

20 lines
395 B
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
var Buffer = require('buffer').Buffer
var http = require('../../..')
module.exports = function (self) {
self.addEventListener('message', function (ev) {
var url = ev.data
http.get(url, function (res) {
var buffers = []
res.on('end', function () {
self.postMessage(Buffer.concat(buffers).buffer)
})
res.on('data', function (data) {
buffers.push(data)
})
})
})
}