@radicalimaging/static-wado-creator 0.6.5 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +0,0 @@
1
- const { Stats } = require("@radicalimaging/static-wado-util");
2
- const path = require("path");
3
- const WriteStream = require("./WriteStream");
4
-
5
- /** Writes out JSON files to the given file name. Automatically GZips them, and adds the extension */
6
- const JSONWriter = async (dir, name, data, options = { gzip: true, brotli: false, index: true }) => {
7
- const fileName = options.index ? "index.json.gz" : name + ((options.gzip && ".gz") || (options.brotli && ".br") || "");
8
- const dirName = options.index ? path.join(dir, name) : dir;
9
- const writeStream = WriteStream(dirName, fileName, {
10
- ...options,
11
- mkdir: true,
12
- });
13
- await writeStream.write(JSON.stringify(data));
14
- await writeStream.close();
15
- Stats.StudyStats.add("Write JSON", `Write JSON file ${name}`, 1000);
16
- };
17
-
18
- module.exports = JSONWriter;