source: trip-planner-front/node_modules/hdr-histogram-js/base64.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 476 bytes
Line 
1const fs = require("fs");
2const zlib = require("zlib");
3
4const src = process.argv[2];
5if (!src || !src.length) {
6 process.stderr.write("missing input file");
7 process.exit(1);
8}
9
10try {
11 const raw = fs.readFileSync(src);
12 const encoded = zlib
13 .deflateSync(Buffer.from(raw), { level: zlib.constants.Z_BEST_COMPRESSION })
14 .toString("base64");
15 process.stdout.write(encoded);
16} catch (e) {
17 process.stderr.write(`error encoding: ${e.message}`);
18 process.exit(1);
19}
Note: See TracBrowser for help on using the repository browser.