const fs = require('fs'); const path = require('path'); const libPath = path.join(__dirname, '../../Documentation/SDK_WIN_x64_2026-1-185/binaries/sketchup/x64'); const files = [ 'SketchUpAPI.lib', 'sketchup.lib' ]; files.forEach(file => { const b64Path = path.join(libPath, file + '.b64'); const outPath = path.join(libPath, file); console.log(`Decoding ${b64Path} -> ${outPath}`); try { if (!fs.existsSync(b64Path)) { console.error(`ERROR: Source file not found: ${b64Path}`); process.exit(1); } const b64Content = fs.readFileSync(b64Path, 'utf8'); // Remove newlines just in case const cleanB64 = b64Content.replace(/\s/g, ''); const buffer = Buffer.from(cleanB64, 'base64'); fs.writeFileSync(outPath, buffer); console.log(`Success! Wrote ${buffer.length} bytes to ${file}`); } catch (e) { console.error(`ERROR decoding ${file}:`, e); process.exit(1); } });