We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I found that busboy's FileStream inherits ReadableStream, so FileStream is missing bytesRead.
Could FileStream inherits fs.ReadStream to support bytesRead property like this:
FileStream
fs.ReadStream
bytesRead
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) { const fs = require('fs') const ws = fs.createWriteStream('busboy.txt') const ps = file.pipe(ws) ps.on('finish', ()=>{ console.log(file.bytesRead); // support bytesRead here console.log(ws.bytesWritten) console.log(ps.bytesWritten) }) });
Full demo:
var http = require('http'), inspect = require('util').inspect; var Busboy = require('busboy'); http.createServer(function(req, res) { if (req.method === 'POST') { var busboy = new Busboy({ headers: req.headers }); busboy.on('file', function(fieldname, file, filename, encoding, mimetype) { const fs = require('fs') const ws = fs.createWriteStream('busboy.txt') const ps = file.pipe(ws) ps.on('finish', ()=>{ console.log(file.bytesRead) console.log(ws.bytesWritten) console.log(ps.bytesWritten) }) }); busboy.on('field', console.log); busboy.on('finish', function() { console.log('Done parsing form!'); res.writeHead(303, { Connection: 'close', Location: '/' }); res.end(); }); req.pipe(busboy); } else if (req.method === 'GET') { res.writeHead(200, { Connection: 'close' }); res.end('<html><head></head><body>\ <form method="POST" enctype="multipart/form-data">\ <input type="file" name="filefield"><br />\ <input type="submit">\ </form>\ </body></html>'); } }).listen(8000, function() { console.log('Listening for requests: http://localhost:8000'); });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I found that busboy's FileStream inherits ReadableStream, so FileStream is missing bytesRead.
Could
FileStream
inheritsfs.ReadStream
to supportbytesRead
property like this:Full demo:
The text was updated successfully, but these errors were encountered: