Update index.js
Browse files19 unmodified lines202122232425261 unmodified line28293031323334353637383919 unmodified linesconst ffmpeg = require('fluent-ffmpeg');const { spawn } = require('child_process');function convertWebmToMp4(webmBuffer) {return new Promise((resolve, reject) => {const ffmpegProcess = spawn('ffmpeg', ['-i', '-', // Input dari stdin1 unmodified line'pipe:1' // Output ke stdout]);ffmpegProcess.on('error', (err) => {reject(err);});ffmpegProcess.on('close', () => {resolve(Buffer.concat(chunks));});ffmpegProcess.stdin.write(webmBuffer);19 unmodified lines202122232425261 unmodified line28293031323334353637383940414243444519 unmodified linesconst ffmpeg = require('fluent-ffmpeg');const { spawn } = require('child_process');async function convertWebmToMp4(webmBuffer) {return new Promise((resolve, reject) => {const ffmpegProcess = spawn('ffmpeg', ['-i', '-', // Input dari stdin1 unmodified line'pipe:1' // Output ke stdout]);let chunks = []; // Define chunks array to accumulate dataffmpegProcess.on('error', (err) => {reject(err);});ffmpegProcess.stdout.on('data', (chunk) => { // Listen for data events from stdoutchunks.push(chunk); // Accumulate data chunks});ffmpegProcess.on('close', () => {resolve(Buffer.concat(chunks)); // Concatenate all chunks into a single buffer});ffmpegProcess.stdin.write(webmBuffer);
index.js+8-2