edfcore 0.6.17 → 0.6.18

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/README.md CHANGED
@@ -52,11 +52,15 @@ In Node, swap the source and nothing else changes:
52
52
  import { openEdf, getSignal, readWindow, toPhysical } from 'edfcore';
53
53
  import { fileSource } from 'edfcore/node';
54
54
 
55
- const recording = await openEdf(await fileSource('./overnight.edf'));
55
+ const source = await fileSource('./overnight.edf');
56
+ const recording = await openEdf(source);
56
57
 
57
58
  console.log(recording.header.variant); // 'EDF+C'
58
59
  console.log(recording.header.signals.map((s) => s.label));
59
60
  console.log(recording.timeline.spanSeconds);
61
+
62
+ // fileSource opens a descriptor and closing it is yours.
63
+ await source.close();
60
64
  ```
61
65
 
62
66
  Reading those ten seconds out of a twelve-hour recording reads roughly ten seconds' worth of
@@ -198,7 +202,8 @@ read.
198
202
  import { openEdf, readWindow, resolveTimeWindow } from 'edfcore';
199
203
  import { fileSource } from 'edfcore/node';
200
204
 
201
- const recording = await openEdf(await fileSource('./overnight.edf'));
205
+ const source = await fileSource('./overnight.edf');
206
+ const recording = await openEdf(source);
202
207
 
203
208
  // resolveTimeWindow is pure and does no I/O, so you can audit the cost first.
204
209
  const ranges = resolveTimeWindow(recording.timeline, recording.index, 3600, 30);
@@ -208,6 +213,8 @@ const chunks = await readWindow(recording, {
208
213
  startSeconds: 3600,
209
214
  durationSeconds: 30,
210
215
  });
216
+
217
+ await source.close();
211
218
  ```
212
219
 
213
220
  Chunks are record-aligned and may be slightly wider than requested. `trimToWindow()` narrows
@@ -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.6.17";
112
+ export declare const VERSION = "0.6.18";
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.6.17';
82
+ export const VERSION = '0.6.18';
83
83
  //# sourceMappingURL=constants.js.map
package/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,20 @@ 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.6.18
10
+
11
+ - **Fixed** the same thing in the two files 0.6.17 could not see. `README.md` and `AGENTS.md` are
12
+ not pages the docs collection loads, so the sweep over the site missed both — and the README is
13
+ what npm renders, which makes its snippets the ones most people meet first. Two of them opened a
14
+ `fileSource` inline and never closed it.
15
+ - **Added** a seventh entry to the mistakes list in `AGENTS.md`: a `fileSource` holds a descriptor
16
+ and closing it is yours. It names the shape that makes closing impossible —
17
+ `await openEdf(await fileSource(path))` — and says why `blobSource` and `byteSource` need none of
18
+ it, so the canonical snippet above it is not read as an omission.
19
+ - `a-file-you-open-is-a-file-you-close.test.ts` sweeps both files now, and ignores a mention inside
20
+ a comment: that snippet says `// or fileSource() from 'edfcore/node'` beside a `blobSource`,
21
+ which is prose about an alternative rather than a file being opened.
22
+
9
23
  ## 0.6.17
10
24
 
11
25
  - **Fixed** `await source.close()` not compiling. `api-sources.md` tells a reader "After that,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.6.17",
3
+ "version": "0.6.18",
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/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.6.17';
96
+ export const VERSION = '0.6.18';