lib/wayback.js
function request(url, options, callback) {
	var debug = require('debug')('wayback:http');
	debug('req', url);

	callback = typeof callback === 'undefined' ? options : callback;

	// @see https://www.npmjs.com/package/fetch
	var stream = new fetch(url, typeof options === 'object' ? options : undefined);

	stream.on('error', function(err) {
		debug('error', err);
		callback(err, null);
	});

	stream.on('meta', function(meta) {
		debug('resp', 'HTTP ' + meta.status);
		debug('resp', meta.responseHeaders);
		callback(null, stream);
	});
}
function request(url, options, callback) {
	var debug = require('debug')('wayback:http');
	debug('req', url);

	callback = typeof callback === 'undefined' ? options : callback;

	// @see https://www.npmjs.com/package/fetch
	var stream = new fetch(url, typeof options === 'object' ? options : undefined);

	stream.on('error', function(err) {
		debug('error', err);
		callback(err, null);
	});

	stream.on('meta', function(meta) {
		debug('resp', 'HTTP ' + meta.status);
		debug('resp', meta.responseHeaders);
		callback(null, stream);
	});
}
function request ( url , options , callback ) { var debug = require ( 'debug' ) ( 'wayback:http' ) ; debug ( 'req' , url ) ; callback = typeof callback === 'undefined' ? options : callback ; // @see https://www.npmjs.com/package/fetch var stream = new fetch ( url , typeof options === 'object' ? options : undefined ) ; stream . on ( 'error' , function ( err ) { debug ( 'error' , err ) ; callback ( err , null ) ; } ) ; stream . on ( 'meta' , function ( meta ) { debug ( 'resp' , 'HTTP ' + meta . status ) ; debug ( 'resp' , meta . responseHeaders ) ; callback ( null , stream ) ; } ) ; }
a simple HTTP client wrapper returning a response stream
a simple HTTP client wrapper returning a response stream