File size: 1,003 Bytes
fe3b43d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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);
    }
});