const fs = require('fs'); const path = require('path'); // 源文件路径 const sourceDir = path.join(__dirname, 'src/assets/jessibuca'); // 目标路径 const targetDir = path.join(__dirname, 'public'); // 确保目标目录存在 if (!fs.existsSync(targetDir)) { fs.mkdirSync(targetDir, { recursive: true }); } // 要复制的文件 const filesToCopy = ['decoder.js', 'decoder.wasm']; // 复制文件 filesToCopy.forEach(file => { const sourcePath = path.join(sourceDir, file); const targetPath = path.join(targetDir, file); if (fs.existsSync(sourcePath)) { fs.copyFileSync(sourcePath, targetPath); console.log(`已复制 ${file} 到 public 目录`); } else { console.error(`源文件 ${sourcePath} 不存在`); } }); console.log('解码器文件复制完成!');