Skip to content

Instantly share code, notes, and snippets.

@silverwind
Last active August 29, 2015 14:26
Show Gist options
  • Save silverwind/10f076397348a64a72a5 to your computer and use it in GitHub Desktop.
Save silverwind/10f076397348a64a72a5 to your computer and use it in GitHub Desktop.

Revisions

  1. silverwind revised this gist Aug 8, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion busboy-memory-test.js
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ http.createServer(function(req, res) {
    file.pipe(fs.createWriteStream(__dirname + '/upload'));
    });
    busboy.on('finish', function() {
    res.writeHead(200, { 'Connection': 'close' });
    res.writeHead(200, {'Connection': 'close'});
    res.end("That's all folks!");
    });
    req.pipe(busboy);
  2. silverwind revised this gist Aug 8, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions busboy-memory-test.js
    Original file line number Diff line number Diff line change
    @@ -10,8 +10,8 @@ http.createServer(function(req, res) {
    '<input type="file" name="upload" multiple="multiple" onchange="this.parentNode.submit()">'+
    '</form>');
    } else if (req.url === '/upload') {
    var busboy = new Busboy({ headers: req.headers });
    busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
    var busboy = new Busboy({headers: req.headers});
    busboy.on('file', function(_, file) {
    file.pipe(fs.createWriteStream(__dirname + '/upload'));
    });
    busboy.on('finish', function() {
  3. silverwind revised this gist Aug 8, 2015. 1 changed file with 3 additions and 5 deletions.
    8 changes: 3 additions & 5 deletions busboy-memory-test.js
    Original file line number Diff line number Diff line change
    @@ -6,11 +6,9 @@ var PORT = 6666;
    http.createServer(function(req, res) {
    if (req.url === '/') {
    res.writeHead(200, {'content-type': 'text/html'});
    res.end(
    '<form action="/upload" enctype="multipart/form-data" method="post">'+
    '<input type="file" name="upload" multiple="multiple" onchange="this.parentNode.submit()"><br>'+
    '</form>'
    );
    res.end('<form action="/upload" enctype="multipart/form-data" method="post">'+
    '<input type="file" name="upload" multiple="multiple" onchange="this.parentNode.submit()">'+
    '</form>');
    } else if (req.url === '/upload') {
    var busboy = new Busboy({ headers: req.headers });
    busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
  4. silverwind revised this gist Aug 8, 2015. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions busboy-memory-test.js
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,6 @@ var fs = require('fs');
    var Busboy = require('busboy');
    var PORT = 6666;

    setInterval(gc.bind(this), 500);

    http.createServer(function(req, res) {
    if (req.url === '/') {
    res.writeHead(200, {'content-type': 'text/html'});
  5. silverwind revised this gist Aug 8, 2015. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions busboy-memory-test.js
    Original file line number Diff line number Diff line change
    @@ -23,9 +23,6 @@ http.createServer(function(req, res) {
    res.end("That's all folks!");
    });
    req.pipe(busboy);
    } else {
    res.writeHead(404, {'content-type': 'text/plain'});
    res.end('404');
    }
    }).listen(PORT, function() {
    console.info('listening on http://0.0.0.0:' + PORT + '/');
  6. silverwind revised this gist Aug 8, 2015. No changes.
  7. silverwind revised this gist Aug 8, 2015. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions busboy-memory-test.js
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,6 @@
    var http = require('http');
    var util = require('util');
    var fs = require('fs');
    var Busboy = require('busboy');
    var path = require('path');
    var PORT = 6666;

    setInterval(gc.bind(this), 500);
  8. silverwind created this gist Aug 8, 2015.
    35 changes: 35 additions & 0 deletions busboy-memory-test.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    var http = require('http');
    var util = require('util');
    var fs = require('fs');
    var Busboy = require('busboy');
    var path = require('path');
    var PORT = 6666;

    setInterval(gc.bind(this), 500);

    http.createServer(function(req, res) {
    if (req.url === '/') {
    res.writeHead(200, {'content-type': 'text/html'});
    res.end(
    '<form action="/upload" enctype="multipart/form-data" method="post">'+
    '<input type="file" name="upload" multiple="multiple" onchange="this.parentNode.submit()"><br>'+
    '</form>'
    );
    } else if (req.url === '/upload') {
    var busboy = new Busboy({ headers: req.headers });
    busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
    file.pipe(fs.createWriteStream(__dirname + '/upload'));
    });
    busboy.on('finish', function() {
    res.writeHead(200, { 'Connection': 'close' });
    res.end("That's all folks!");
    });
    req.pipe(busboy);
    } else {
    res.writeHead(404, {'content-type': 'text/plain'});
    res.end('404');
    }
    }).listen(PORT, function() {
    console.info('listening on http://0.0.0.0:' + PORT + '/');
    });