🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

dcmjs

Package Overview
Dependencies
Maintainers
14
Versions
249
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dcmjs - npm Package Compare versions

Comparing version

to
0.33.0

2

package.json
{
"name": "dcmjs",
"version": "0.32.0",
"version": "0.33.0",
"description": "Javascript implementation of DICOM manipulation",

@@ -5,0 +5,0 @@ "main": "build/dcmjs.js",

@@ -58,5 +58,5 @@ import fs from "fs";

async function getZippedTestDataset(url, filename, unpackDirectory) {
var dir = ensureTestDataDir();
var targetPath = path.join(dir, filename);
var unpackPath = path.join(dir, unpackDirectory);
const dir = ensureTestDataDir();
const targetPath = path.join(dir, filename);
const unpackPath = path.join(dir, unpackDirectory);
if (!fs.existsSync(unpackPath)) {

@@ -69,8 +69,17 @@ await downloadToFile(url, targetPath);

/**
* Stores the required downloads to prevent async reading before download completed.
*/
const asyncDownloadMap = new Map();
async function getTestDataset(url, filename) {
var dir = ensureTestDataDir();
var targetPath = path.join(dir, filename);
if (!fs.existsSync(targetPath)) {
await downloadToFile(url, targetPath);
const dir = ensureTestDataDir();
const targetPath = path.join(dir, filename);
let filePromise = asyncDownloadMap.get(targetPath);
if (!filePromise && !fs.existsSync(targetPath)) {
filePromise = downloadToFile(url, targetPath);
asyncDownloadMap.set(targetPath,filePromise);
}
// This returns immediately if filePromise is undefined - eg if the file already downloaded.
await filePromise;
return targetPath;

@@ -77,0 +86,0 @@ }