UNPKG

@phensley/cldr

Version:

Internationalization in Typescript with Unicode CLDR, batteries included

23 lines (18 loc) 558 B
const fs = require('fs'); const { basename, join } = require('path'); const zlib = require('zlib'); const EXT = '.json.gz'; const root = join(__dirname, '..', 'packs'); if (!fs.existsSync(root)) { fs.mkdirSync(root); } const packs = fs.readdirSync(root) .filter(n => n.endsWith(EXT)) .map(n => join(root, n)); packs.forEach(src => { const name = basename(src, EXT); const dst = join(root, `${name}.json`); const compressed = fs.readFileSync(src); const raw = zlib.gunzipSync(compressed).toString('utf-8'); fs.writeFileSync(dst, raw); });