edfcore 0.4.177 → 0.4.178

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 CHANGED
@@ -41,7 +41,24 @@ proc.stdout.on('error', (error) => {
41
41
  throw error;
42
42
  });
43
43
  const io = {
44
- readFile: (path) => fs.readFile(path),
44
+ /*
45
+ * A directory reaches `fs.readFile` and comes back as a raw `EISDIR: illegal operation on a
46
+ * directory, read` — an errno with no path in it and nothing to do next. `fileSource` was fixed
47
+ * for exactly this in 0.3.98, but the CLI reads the whole file itself rather than going through
48
+ * that adapter, so it never got the fix. `ENOENT` is left alone: Node's own text already names
49
+ * the path and says what is wrong (fixed in 0.4.178).
50
+ */
51
+ readFile: async (path) => {
52
+ try {
53
+ return await fs.readFile(path);
54
+ }
55
+ catch (error) {
56
+ if (error?.code !== 'EISDIR')
57
+ throw error;
58
+ throw new Error(`${JSON.stringify(path)} is a directory, not a file. Next: name the .edf or .bdf ` +
59
+ 'file inside it.');
60
+ }
61
+ },
45
62
  out: (text) => {
46
63
  proc.stdout.write(text);
47
64
  },
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG;AAEH,8FAA8F;AAC9F,2FAA2F;AAC3F,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,qDAAqD;AACrD,uFAAuF;AACvF,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAc,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAezC,MAAM,EAAE,GAAW,cAAmC,CAAC;AACvD,MAAM,IAAI,GACP,WAAoD,CAAC,OAAO;IAC5D,WAAsC,CAAC;AAE1C;;;;;;;;;;;;GAYG;AACH,IAAI,CAAC,MAAM,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,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF,CAAC;AAEF,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAClE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,6FAA6F;QAC7F,4CAA4C;QAC5C,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5F,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,OAAO,IAAI,CAAC,CAAC;QAC3C,4FAA4F;QAC5F,0FAA0F;QAC1F,gBAAgB;QAChB,IAAI,CAAC,QAAQ,GAAG,KAAK,YAAY,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC;AACH,CAAC;AAED,8FAA8F;AAC9F,+FAA+F;AAC/F,6DAA6D;AAC7D,KAAK,IAAI,EAAE,CAAC"}
@@ -109,5 +109,5 @@ export declare const SIGNAL_FIELD_BLOCK_OFFSETS: {
109
109
  readonly reserved: 224;
110
110
  };
111
111
  /** Published package version. Kept in sync with package.json by a test. */
112
- export declare const VERSION = "0.4.177";
112
+ export declare const VERSION = "0.4.178";
113
113
  //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js CHANGED
@@ -79,5 +79,5 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
79
79
  reserved: 224,
80
80
  };
81
81
  /** Published package version. Kept in sync with package.json by a test. */
82
- export const VERSION = '0.4.177';
82
+ export const VERSION = '0.4.178';
83
83
  //# sourceMappingURL=constants.js.map
package/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ alone does not tell you whether you were affected.
6
6
  edfcore is pre-1.0. Patch releases have carried behaviour changes where the old behaviour was a
7
7
  defect; those are called out below.
8
8
 
9
+ ## 0.4.178
10
+
11
+ - **Fixed** `edfcore <command> <directory>` reporting a raw `EISDIR: illegal operation on a
12
+ directory, read` — an errno carrying no path and no next step. `fileSource` was fixed for this in
13
+ 0.3.98, but the CLI reads the file itself rather than going through that adapter, so it never got
14
+ the fix. `ENOENT` is left as Node writes it, since that text already names the path.
15
+
9
16
  ## 0.4.177
10
17
 
11
18
  - **Added** a test that runs the CLI as a process with its output piped into `head`. Every other
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.4.177",
3
+ "version": "0.4.178",
4
4
  "description": "Modern, typed, zero-dependency reader for EDF, EDF+, BDF and BDF+ biosignal files. Works in browsers and Node with true random access.",
5
5
  "keywords": [
6
6
  "edf",
package/src/cli.ts CHANGED
@@ -58,7 +58,24 @@ proc.stdout.on('error', (error) => {
58
58
  });
59
59
 
60
60
  const io: CliIo = {
61
- readFile: (path) => fs.readFile(path),
61
+ /*
62
+ * A directory reaches `fs.readFile` and comes back as a raw `EISDIR: illegal operation on a
63
+ * directory, read` — an errno with no path in it and nothing to do next. `fileSource` was fixed
64
+ * for exactly this in 0.3.98, but the CLI reads the whole file itself rather than going through
65
+ * that adapter, so it never got the fix. `ENOENT` is left alone: Node's own text already names
66
+ * the path and says what is wrong (fixed in 0.4.178).
67
+ */
68
+ readFile: async (path) => {
69
+ try {
70
+ return await fs.readFile(path);
71
+ } catch (error) {
72
+ if ((error as { code?: string } | null)?.code !== 'EISDIR') throw error;
73
+ throw new Error(
74
+ `${JSON.stringify(path)} is a directory, not a file. Next: name the .edf or .bdf ` +
75
+ 'file inside it.',
76
+ );
77
+ }
78
+ },
62
79
  out: (text) => {
63
80
  proc.stdout.write(text);
64
81
  },
package/src/constants.ts CHANGED
@@ -93,4 +93,4 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
93
93
  } as const;
94
94
 
95
95
  /** Published package version. Kept in sync with package.json by a test. */
96
- export const VERSION = '0.4.177';
96
+ export const VERSION = '0.4.178';