Skip to content

Instantly share code, notes, and snippets.

@PaulMougel
Created March 3, 2014 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PaulMougel/9323085 to your computer and use it in GitHub Desktop.
Save PaulMougel/9323085 to your computer and use it in GitHub Desktop.
Simple download app using Express and node.js' streams
var fs = require('fs');
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.attachment();
fs.createReadStream('test.pdf').pipe(res);
});
app.listen(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment