Improve buffer allocation for copying files in utils/filesystem.js