How to use the send.pipe function in send

To help you get started, we’ve selected a few send examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lalcmellkmal / doushio / imager / index.js View on Github external
exports.serve_image = function (req, resp) {
	var m = /^\/(src|thumb|mid|vint)(\/\d+\.\w+)$/.exec(req.url);
	if (!m)
		return false;
	var root = config.MEDIA_DIRS[m[1]];
	if (!root)
		return false;
	require('send')(req, m[2], {root: root}).pipe(resp);
	return true;
};

send

Better streaming static file server with Range and conditional-GET support

MIT
Latest version published 2 years ago

Package Health Score

76 / 100
Full package analysis