edf2csv 0.7.9 → 0.7.11
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/cli.js +26 -0
- package/dist/cli.js.map +1 -1
- package/dist/convert/run.js +2 -8
- package/dist/convert/run.js.map +1 -1
- package/dist/edf/reader.js +1 -1
- package/dist/edf/reader.js.map +1 -1
- package/dist/format/csv.js +0 -1
- package/dist/format/csv.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -379,6 +379,32 @@ export async function main(argv) {
|
|
|
379
379
|
return EXIT_USAGE;
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
+
/*
|
|
383
|
+
Compressed bytes at a terminal.
|
|
384
|
+
|
|
385
|
+
`--stdout --gzip` is a documented pair, and every place it is documented redirects it:
|
|
386
|
+
`edf2csv rec.edf --stdout --gzip > signals.csv.gz`. Without the redirect it wrote the
|
|
387
|
+
deflate stream to the terminal — 46 control bytes and three ESCs out of 244 for the
|
|
388
|
+
smallest fixture here, which is a terminal left in whatever state those happened to
|
|
389
|
+
describe, and nothing usable on the screen either way.
|
|
390
|
+
|
|
391
|
+
This tool escapes every control byte out of a header before printing it, on the reasoning
|
|
392
|
+
that a file should not be able to drive the reader's terminal. Doing it to them directly,
|
|
393
|
+
from output it generated itself, is the same hazard with the argument for it removed.
|
|
394
|
+
|
|
395
|
+
Only when stdout is a terminal. A pipe and a regular file are both `isTTY === false`, so
|
|
396
|
+
the documented command is unaffected — and that is also why this cannot be answered by
|
|
397
|
+
refusing the flag pair outright, the way `--stdout --json` is.
|
|
398
|
+
|
|
399
|
+
gzip itself has declined to write compressed data to a terminal for thirty years, which
|
|
400
|
+
is where a reader's expectation comes from.
|
|
401
|
+
*/
|
|
402
|
+
if (toStdout && values['gzip'] === true && process.stdout.isTTY === true) {
|
|
403
|
+
process.stderr.write('error: --stdout --gzip would write compressed bytes straight to the terminal.\n' +
|
|
404
|
+
detail('Redirect it to a file or a pipe:') +
|
|
405
|
+
` edf2csv <recording> --stdout --gzip > signals.csv.gz\n`);
|
|
406
|
+
return EXIT_USAGE;
|
|
407
|
+
}
|
|
382
408
|
/*
|
|
383
409
|
One recording prints the document it always printed; several print one per line.
|
|
384
410
|
|