Refactor base64.js task for improved maintainability