edfcore 0.6.17 → 0.6.19
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 +9 -2
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/docs/CHANGELOG.md +33 -0
- package/package.json +1 -1
- package/src/constants.ts +1 -1
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
|
|
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
|
|
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
|
package/dist/constants.d.ts
CHANGED
|
@@ -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.
|
|
112
|
+
export declare const VERSION = "0.6.19";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
package/docs/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,39 @@ 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.19
|
|
10
|
+
|
|
11
|
+
- **Added** a twelfth shape to the `AWKWARD` matrix: a file whose record count field says `-1`, so
|
|
12
|
+
the count is recovered from the source length. `types.ts` says of that field "`-1` means the
|
|
13
|
+
writer never closed the file", and it is not a rare accident — it is what a recorder writes while
|
|
14
|
+
it is still recording, and what stays there if the software crashes or the disk fills.
|
|
15
|
+
- The recovery itself was covered — `parse.test.ts` for the arithmetic,
|
|
16
|
+
`one-recording-two-spellings.test.ts` for the equivalence — and the shape had never been put in
|
|
17
|
+
front of the twenty-two sweeps that run over the matrix: every index resolves, ticks and seconds
|
|
18
|
+
agree, every array is frozen, nothing points at the caller's buffer, the five source spellings,
|
|
19
|
+
and the rest. It is the only shape in the matrix whose geometry rests on arithmetic rather than
|
|
20
|
+
on a number the file states, and each of those sweeps asks a question of a whole file.
|
|
21
|
+
- They all pass over it. That is the result: the properties were stated to hold for any file, and
|
|
22
|
+
until now none of them had seen one whose record count nobody wrote down.
|
|
23
|
+
- `a-count-the-header-never-gave.test.ts` pins what makes it that shape — `-1` in the field, five in
|
|
24
|
+
the header, `recordCountSource: 'sourceByteLength'`, and the diagnostic that says so — and checks
|
|
25
|
+
it is the only shape in the matrix that recovers. A fixture drifting into an ordinary file would
|
|
26
|
+
otherwise leave twenty-two sweeps looking as though they cover something they no longer do.
|
|
27
|
+
|
|
28
|
+
## 0.6.18
|
|
29
|
+
|
|
30
|
+
- **Fixed** the same thing in the two files 0.6.17 could not see. `README.md` and `AGENTS.md` are
|
|
31
|
+
not pages the docs collection loads, so the sweep over the site missed both — and the README is
|
|
32
|
+
what npm renders, which makes its snippets the ones most people meet first. Two of them opened a
|
|
33
|
+
`fileSource` inline and never closed it.
|
|
34
|
+
- **Added** a seventh entry to the mistakes list in `AGENTS.md`: a `fileSource` holds a descriptor
|
|
35
|
+
and closing it is yours. It names the shape that makes closing impossible —
|
|
36
|
+
`await openEdf(await fileSource(path))` — and says why `blobSource` and `byteSource` need none of
|
|
37
|
+
it, so the canonical snippet above it is not read as an omission.
|
|
38
|
+
- `a-file-you-open-is-a-file-you-close.test.ts` sweeps both files now, and ignores a mention inside
|
|
39
|
+
a comment: that snippet says `// or fileSource() from 'edfcore/node'` beside a `blobSource`,
|
|
40
|
+
which is prose about an alternative rather than a file being opened.
|
|
41
|
+
|
|
9
42
|
## 0.6.17
|
|
10
43
|
|
|
11
44
|
- **Fixed** `await source.close()` not compiling. `api-sources.md` tells a reader "After that,
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED