edf2csv 0.8.82 → 0.8.84
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.
- package/dist/convert/run.js +21 -3
- package/dist/convert/run.js.map +1 -1
- package/dist/edf/header.js +39 -3
- package/dist/edf/header.js.map +1 -1
- package/package.json +1 -1
package/dist/convert/run.js
CHANGED
|
@@ -412,11 +412,29 @@ async function prepareOutputDir(dir, force) {
|
|
|
412
412
|
*/
|
|
413
413
|
if (!existing && (await lstat(dir).catch(() => null))) {
|
|
414
414
|
throw new ConversionError('OUTPUT_UNWRITABLE', `"${dir}" is a symbolic link to something that does not exist, so nothing can be ` +
|
|
415
|
-
`written there.`, 'Remove the link, or choose a directory with --out. --force
|
|
416
|
-
'
|
|
415
|
+
`written there.`, 'Remove the link, or choose a directory with --out. --force writes into a directory ' +
|
|
416
|
+
'that is already there, and a link to nowhere is not one.');
|
|
417
417
|
}
|
|
418
418
|
if (!force) {
|
|
419
|
-
|
|
419
|
+
/*
|
|
420
|
+
What `--force` does, rather than what it sounds like it does.
|
|
421
|
+
|
|
422
|
+
"Overwrite it" reads as a claim about the directory, and the neighbouring hint said so
|
|
423
|
+
outright — "--force replaces a previous output directory". It does neither. It writes
|
|
424
|
+
into the directory: files of the same name are replaced and everything else is left
|
|
425
|
+
exactly where it was, which is why `STALE_OUTPUT` exists to report what stayed. The
|
|
426
|
+
flag list has described it accurately since it was written — "write into the output
|
|
427
|
+
directory if it already exists" — so the one sentence a reader meets at the moment
|
|
428
|
+
they decide whether to pass it was the one contradicting the other two.
|
|
429
|
+
|
|
430
|
+
The difference is a directory that ends up holding two conversions. Convert a
|
|
431
|
+
mixed-rate recording and then a single-rate one into the same place with `--force`,
|
|
432
|
+
and `signals_256hz.csv` sits beside a fresh `signals.csv` under a channels.csv and a
|
|
433
|
+
metadata.json describing only the second — which is exactly the outcome a reader who
|
|
434
|
+
was told the directory would be replaced does not expect, and does not check for.
|
|
435
|
+
*/
|
|
436
|
+
throw new ConversionError('OUTPUT_EXISTS', `"${dir}" already exists.`, 'Pass --force to write into it, leaving whatever else it holds, or --out to choose ' +
|
|
437
|
+
'a different directory.');
|
|
420
438
|
}
|
|
421
439
|
}
|
|
422
440
|
}
|