const fs = require('fs'); // Function to encode data to base64 function encodeToBase64(data) { return Buffer.from(data, 'utf-8').toString('base64'); } // Function to encode .env file to base64 function encodeEnvFileToBase64(envFilePath, outputFilePath) { // Read the content of the .env file const envData = fs.readFileSync(envFilePath, 'utf-8'); // Encode the data to base64 const base64Data = encodeToBase64(envData); // Write the base64-encoded data to a new file fs.writeFileSync(outputFilePath, base64Data, 'utf-8'); console.log('File encoded to base64 successfully.'); } // Example usage const envFilePath = '/.env'; const outputFilePath = '/encoded_base64.env'; encodeEnvFileToBase64(envFilePath, outputFilePath);