aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/sqlite3/deps/extract.js
blob: 0e1fb123f4e6f28b9cd43c4a09cffd7ac571f7f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const tar = require("tar");
const fs = require("fs");
const path = require("path");
const tarball = path.resolve(process.argv[2]);
const dirname = path.resolve(process.argv[3]);

tar.extract({
    sync: true,
    file: tarball,
    cwd: dirname,
});

// SQLite >= 3.49 ships a VERSION file that conflicts with the C++20 <version>
// header on case-insensitive filesystems (macOS/Windows).
const base = path.basename(tarball, ".tar.gz");
const versionFile = path.join(dirname, base, "VERSION");
if (fs.existsSync(versionFile)) {
    fs.unlinkSync(versionFile);
}