git.schokokeks.org
Repositories
Help
Report an Issue
fs-words.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
6e9c872
Branches
Tags
develop-client_server
master
typescript
fs-words.git
server
lib
node_modules
needle
examples
stream-events.js
[add] server:lib:node_modules
Christian Fraß
commited
6e9c872
at 2021-03-08 23:52:07
stream-events.js
Blame
History
Raw
var needle = require('./..'); var resp = needle.get('google.com', { follow_max: 10, timeout: 5000 }); resp.on('readable', function() { var chunk; while (chunk = this.read()) { console.log('Got ' + chunk.length + ' bytes'); } }) resp.on('headers', function(headers) { console.log('Got headers', headers); }) resp.on('redirect', function(url) { console.log('Redirected to url ' + url); }) resp.on('done', function(err) { console.log('Finished. No more data to receive.'); if (err) console.log('With error', err) })