We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9dc329a commit eb6e002Copy full SHA for eb6e002
src/files/deno.ts
@@ -58,11 +58,18 @@ export class BIDSFileDeno implements BIDSFile {
58
* Read the entire file and decode as utf-8 text
59
*/
60
async text(): Promise<string> {
61
- let chunks: string[] = []
62
- for await (const chunk of this.stream.pipeThrough(createUTF8Stream())) {
63
- chunks.push(chunk)
+ const reader = this.stream.pipeThrough(createUTF8Stream()).getReader()
+ const chunks: string[] = []
+ try {
64
+ while (true) {
65
+ const { done, value } = await reader.read()
66
+ if (done) break
67
+ chunks.push(value)
68
+ }
69
+ return chunks.join('')
70
+ } finally {
71
+ reader.releaseLock()
72
}
- return chunks.join('')
73
74
75
/**
0 commit comments