expressjs / compression

Node.js compression middleware
MIT License
2.77k stars 241 forks source link

Don't copy chunks if they're already buffers #154

Closed zbjornson closed 5 years ago

zbjornson commented 5 years ago

Buffer.from(buffer) copies the buffer, which seems unnecessary. What do you think?

dougwilson commented 5 years ago

Indeed, it does copy the underlying data into a new buffer, which is definitely unnecessary. This looks good, and I'll get this merged tomorrow with your other PR 🎉

zbjornson commented 5 years ago

Not at all! :) Thanks