You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
395 B
20 lines
395 B
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)
|
|
})
|
|
})
|
|
})
|
|
}
|