@iebh/reflib 2.8.0 → 2.8.1

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/.ignore CHANGED
@@ -1 +1 @@
1
- test/data/
1
+ test/data/
package/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2022 Bond University Institute for Evidence-Based Healthcare
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Bond University Institute for Evidence-Based Healthcare
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,297 +1,297 @@
1
- @IEBH/Reflib
2
- ============
3
- Reference library processing for Node.
4
-
5
- This library provides various read/write functionality to process citation libraries and handle individual references (henceforth "Refs").
6
-
7
- This module forms part of the [Systematic Review Accelerator](https://sr-accelerator.com)
8
-
9
-
10
- Compatibility
11
- =============
12
-
13
- | Library | Extension(s) | Read | Write |
14
- |------------------------|-----------------|--------------------|--------------------|
15
- | BibTeX | `.bib` | :heavy_check_mark: | :heavy_check_mark: |
16
- | Comma Separated Values | `.csv` | :x: | :x: |
17
- | EndNote ENL | `.enl` | :heavy_check_mark: | (untested) |
18
- | EndNote ENLX | `.enlx` | :heavy_check_mark: | :x: |
19
- | EndNote XML | `.xml` | :heavy_check_mark: | :heavy_check_mark: |
20
- | JSON | `.json` | :heavy_check_mark: | :heavy_check_mark: |
21
- | Medline | `.nbib` | :heavy_check_mark: | :heavy_check_mark: |
22
- | RIS | `.ris` | :heavy_check_mark: | :heavy_check_mark: |
23
- | Tab Separated Values | `.tsv` | :x: | :x: |
24
-
25
-
26
- **Notes on different formats**:
27
-
28
- * Not all formats are one-to-one translations, some have differing field definitions or type definitions
29
- * BibTeX support is only provided for "well-formatted" files - i.e. correct use of newlines rather than one-single-line-per-ref, this is to avoid having to implement a full AST parser
30
- * Medline seems to implement a totally different [publication type system](https://www.nlm.nih.gov/mesh/pubtypes.html) than others. Reflib will attempt to guess the best match, storing the original type in the `medlineType` key. Should the citation library be exported _back_ to Medline / `.nbib` files this key will take precedence to avoid data loss
31
-
32
-
33
- Command Line Interface
34
- ======================
35
- This NPM ships with a very basic Command Line Interface (CLI) for very basic Reflib files manipulation.
36
-
37
- ```
38
- Usage: reflib -i INPUT_FILE [-f FORMAT] [-o -|OUTPUT_FILE]
39
-
40
-
41
- -i, --input <file> Input file to process
42
-
43
- -o, --output <file> Output file to save. Use '-' for STDOUT
44
-
45
- -f, --format <reflib-format> Override or set the file output type (if omitted the outfile filename
46
- is used to determine the format)
47
-
48
- -v, --verbose Be verbose when processing
49
-
50
- --version Print CLI version and exit
51
-
52
- -h, --help This help screen
53
- ```
54
-
55
-
56
- Reference Structure
57
- ===================
58
- Reflib creates a simple Plain-Old-JavaScript-Object (POJO) for each reference it parses, or writes to a file format when given a collection of the same.
59
-
60
- Each reference has the following standardized fields, these are translated from whatever internal format each module uses - e.g. the `TY` RIS field is automatically translated to `title`.
61
-
62
-
63
- | Field | Type | Description |
64
- |------------------|-----------------|----------------------------------------------------------------------------------------|
65
- | recNumber | `Number` | The sorting number of the reference. Not present in RIS files |
66
- | type | `String` | A supported [reference type](#reference-types) (e.g. journalArticle) |
67
- | title | `String` | The reference's main title |
68
- | journal | `String` | The reference's secondary title, this is usually the journal for most published papers |
69
- | authors | `Array<String>` | An array of each Author in the originally specified format |
70
- | date | `String` | The raw, internal date of the reference |
71
- | urls | `Array<String>` | An array of each URL for the reference |
72
- | pages | `String` | The page reference, usually in the format `123-4` |
73
- | volume | `String` | |
74
- | number | `String` | |
75
- | isbn | `String` | |
76
- | abstract | `String` | |
77
- | label | `String` | |
78
- | caption | `String` | |
79
- | notes | `String` | |
80
- | address | `String` | |
81
- | researchNotes | `String` | |
82
- | keywords | `Array<String>` | Optional list of keywords that apply to the reference |
83
- | accessDate | `String` | |
84
- | accession | `String` | [Accession numbers spec](https://support.nlm.nih.gov/knowledgebase/article/KA-03434/en-us), can sometimes be the PubMed ID |
85
- | doi | `String` | |
86
- | section | `String` | |
87
- | language | `String` | |
88
- | researchNotes | `String` | |
89
- | databaseProvider | `String` | |
90
- | database | `String` | |
91
- | workType | `String` | |
92
- | custom1 | `String` | |
93
- | custom2 | `String` | |
94
- | custom3 | `String` | |
95
- | custom4 | `String` | |
96
- | custom5 | `String` | |
97
- | custom6 | `String` | |
98
- | custom7 | `String` | |
99
-
100
-
101
- Reference Types
102
- ---------------
103
- As with refs the following ref types are supported and translated from the module internal formats.
104
-
105
-
106
- ```
107
- aggregatedDatabase
108
- ancientText
109
- artwork
110
- audioVisualMaterial
111
- bill
112
- blog
113
- book
114
- bookSection
115
- case
116
- catalog
117
- chartOrTable
118
- classicalWork
119
- computerProgram
120
- conferencePaper
121
- conferenceProceedings
122
- dataset
123
- dictionary
124
- editedBook
125
- electronicArticle
126
- electronicBook
127
- electronicBookSection
128
- encyclopedia
129
- equation
130
- figure
131
- filmOrBroadcast
132
- generic
133
- governmentDocument
134
- grant
135
- hearing
136
- journalArticle
137
- legalRuleOrRegulation
138
- magazineArticle
139
- manuscript
140
- map
141
- music
142
- newspaperArticle
143
- onlineDatabase
144
- onlineMultimedia
145
- pamphlet
146
- patent
147
- personalCommunication
148
- report
149
- serial
150
- standard
151
- statute
152
- thesis
153
- unknown
154
- unpublished
155
- web
156
- ```
157
-
158
-
159
-
160
- API
161
- ===
162
- Each API is available either from the default `reflib` object or as a separate import.
163
-
164
-
165
- ```javascript
166
- import reflib from 'reflib'; // Import everything as `reflib`
167
- reflib.readFile(path);
168
- reflib.writeFile(path, refs);
169
-
170
-
171
- import {readFile, writeFile} from 'reflib'; // Import specific functions
172
- readFile(path);
173
- writeFile(path, refs);
174
- ```
175
-
176
-
177
- formats
178
- =======
179
- Available: Node + Browser
180
- A lookup object of all supported citation library formats.
181
- Each key is the unique ID of that module.
182
-
183
- Properties are:
184
-
185
- | Key | Type | Description |
186
- |--------------|-----------------|------------------------------------------------------------------------|
187
- | `id` | `String` | The unique ID of that module (same as object key) |
188
- | `title` | `String` | Longer, human readable title of the module |
189
- | `titleShort` | `String` | Shorter, human readable title of the module |
190
- | `ext` | `Array<String>` | Array of output file extensions, first extension should be the default |
191
- | `canRead` | `boolean` | Whether the format is supported when reading a citation library |
192
- | `canWrite` | `boolean` | Whether the format is supported when writing a citation library |
193
-
194
-
195
- identifyFormat(path)
196
- ====================
197
- Available: Node + Browser
198
- Attempt to determine the format of a file on disk from its path. The file does not need to actually exist.
199
-
200
- ```javascript
201
- identifyFormat('My Refs.csv') //= csv
202
- identifyFormat('My Refs.json') //= json
203
- identifyFormat('My Refs.nbib') //= nbib
204
- identifyFormat('My Refs.txt.ris') //= ris
205
- identifyFormat('MY REFS.TXT.RIS') //= ris
206
- identifyFormat('My Refs.data.tsv') //= tsv
207
- identifyFormat('My Refs.xml') //= endnoteXml
208
- ```
209
-
210
-
211
- readFile(path, options)
212
- =======================
213
- Available: Node
214
- Read a file on disk, returning a Promise which will resolve with an array of all Refs extracted.
215
-
216
- ```javascript
217
- reflib.readFile('./data/json/json1.json')
218
- .then(refs => /* Do something with Ref collection */)
219
- ```
220
-
221
- An emitter is available to track progress while reading. Note that due to the chainable nature of promises the first return contains the `emitter` key only:
222
-
223
- ```javascript
224
- let reader = reflib.readFile('./data/json/json1.json');
225
-
226
- reader.emitter
227
- .on('progress', ({readBytes, totalSize, refsFound}) => /* Report progress somehow */);
228
- .on('end', ({refsFound}) => /* Report progress somehow */);
229
-
230
- reader
231
- .then(refs => /* Do something with Ref collection */)
232
- ```
233
-
234
- uploadFile(options)
235
- ===================
236
- Available: Browser
237
- Prompt the user for a file and process it into an array of citations.
238
-
239
- ```javascript
240
- reflib.uploadFile({ // Additional options
241
- file, // Optional File object if known, if omitted this function will prompt the user to select a file
242
- onStart, // Async function called as `(File)` when starting the read stage
243
- onProgress, // Function called as `(position, totalSize)` when processing the file
244
- onEnd, // Async function called as `()` when the read stage has completed
245
- })
246
- .then(refs => /* Do something with Ref collection */)
247
- ```
248
-
249
-
250
- writeFile(path, refs, options)
251
- ==============================
252
- Available: Node
253
- Write a file back to disk, returning a Promise which will resolve when done.
254
-
255
- ```javascript
256
- reflib.writeFile('MyRefs.xml', refs);
257
- ```
258
-
259
-
260
-
261
- readStream(moduleId, inputStream, options)
262
- ==========================================
263
- Available: Node + Browser
264
- Low level worker of `readFile()`.
265
- Accept an input Stream.Readable and return a emitter which will emit each Ref found.
266
-
267
- ```javascript
268
- reflib.readStream('json', createReadStream('./data/json/json1.json'))
269
- .on('end', ()=> /* Finished reading */)
270
- .on('error', err => /* Deal with errors */)
271
- .on('ref', ref => /* Do something with extracted Ref */)
272
- ```
273
-
274
-
275
- writeStream(moduleId, outputStream, options)
276
- ============================================
277
- Available: Node + Browser
278
- Low level worker of `writeFile()`.
279
- Return an object with methods to call to write to a given stream.
280
- The returned object will have a `start()`, `end()` and `write(ref)` (optional `middle(ref)`) function which can be called to write to the original input stream.
281
-
282
- ```javascript
283
- // Convert a JSON file to EndNoteXML via a stream
284
- let output = reflib.writeStream('json', createWriteStream('./MyRefs.xml'));
285
-
286
- output.start(); // Begin stream writing
287
-
288
- reflib.readStream('json', createReadStream('./data/json/json1.json'))
289
- .on('ref', ref => output.write(ref))
290
- .on('end', ()=> output.end())
291
- ```
292
-
293
-
294
- Credits
295
- =======
296
- Developed for the [Bond University Institute for Evidence-Based Healthcare](https://iebh.bond.edu.au).
297
- Please contact [the author](mailto:matt_carter@bond.edu.au) with any issues.
1
+ @IEBH/Reflib
2
+ ============
3
+ Reference library processing for Node.
4
+
5
+ This library provides various read/write functionality to process citation libraries and handle individual references (henceforth "Refs").
6
+
7
+ This module forms part of the [Systematic Review Accelerator](https://sr-accelerator.com)
8
+
9
+
10
+ Compatibility
11
+ =============
12
+
13
+ | Library | Extension(s) | Read | Write |
14
+ |------------------------|-----------------|--------------------|--------------------|
15
+ | BibTeX | `.bib` | :heavy_check_mark: | :heavy_check_mark: |
16
+ | Comma Separated Values | `.csv` | :x: | :x: |
17
+ | EndNote ENL | `.enl` | :heavy_check_mark: | (untested) |
18
+ | EndNote ENLX | `.enlx` | :heavy_check_mark: | :x: |
19
+ | EndNote XML | `.xml` | :heavy_check_mark: | :heavy_check_mark: |
20
+ | JSON | `.json` | :heavy_check_mark: | :heavy_check_mark: |
21
+ | Medline | `.nbib` | :heavy_check_mark: | :heavy_check_mark: |
22
+ | RIS | `.ris` | :heavy_check_mark: | :heavy_check_mark: |
23
+ | Tab Separated Values | `.tsv` | :x: | :x: |
24
+
25
+
26
+ **Notes on different formats**:
27
+
28
+ * Not all formats are one-to-one translations, some have differing field definitions or type definitions
29
+ * BibTeX support is only provided for "well-formatted" files - i.e. correct use of newlines rather than one-single-line-per-ref, this is to avoid having to implement a full AST parser
30
+ * Medline seems to implement a totally different [publication type system](https://www.nlm.nih.gov/mesh/pubtypes.html) than others. Reflib will attempt to guess the best match, storing the original type in the `medlineType` key. Should the citation library be exported _back_ to Medline / `.nbib` files this key will take precedence to avoid data loss
31
+
32
+
33
+ Command Line Interface
34
+ ======================
35
+ This NPM ships with a very basic Command Line Interface (CLI) for very basic Reflib files manipulation.
36
+
37
+ ```
38
+ Usage: reflib -i INPUT_FILE [-f FORMAT] [-o -|OUTPUT_FILE]
39
+
40
+
41
+ -i, --input <file> Input file to process
42
+
43
+ -o, --output <file> Output file to save. Use '-' for STDOUT
44
+
45
+ -f, --format <reflib-format> Override or set the file output type (if omitted the outfile filename
46
+ is used to determine the format)
47
+
48
+ -v, --verbose Be verbose when processing
49
+
50
+ --version Print CLI version and exit
51
+
52
+ -h, --help This help screen
53
+ ```
54
+
55
+
56
+ Reference Structure
57
+ ===================
58
+ Reflib creates a simple Plain-Old-JavaScript-Object (POJO) for each reference it parses, or writes to a file format when given a collection of the same.
59
+
60
+ Each reference has the following standardized fields, these are translated from whatever internal format each module uses - e.g. the `TY` RIS field is automatically translated to `title`.
61
+
62
+
63
+ | Field | Type | Description |
64
+ |------------------|-----------------|----------------------------------------------------------------------------------------|
65
+ | recNumber | `Number` | The sorting number of the reference. Not present in RIS files |
66
+ | type | `String` | A supported [reference type](#reference-types) (e.g. journalArticle) |
67
+ | title | `String` | The reference's main title |
68
+ | journal | `String` | The reference's secondary title, this is usually the journal for most published papers |
69
+ | authors | `Array<String>` | An array of each Author in the originally specified format |
70
+ | date | `String` | The raw, internal date of the reference |
71
+ | urls | `Array<String>` | An array of each URL for the reference |
72
+ | pages | `String` | The page reference, usually in the format `123-4` |
73
+ | volume | `String` | |
74
+ | number | `String` | |
75
+ | isbn | `String` | |
76
+ | abstract | `String` | |
77
+ | label | `String` | |
78
+ | caption | `String` | |
79
+ | notes | `String` | |
80
+ | address | `String` | |
81
+ | researchNotes | `String` | |
82
+ | keywords | `Array<String>` | Optional list of keywords that apply to the reference |
83
+ | accessDate | `String` | |
84
+ | accession | `String` | [Accession numbers spec](https://support.nlm.nih.gov/knowledgebase/article/KA-03434/en-us), can sometimes be the PubMed ID |
85
+ | doi | `String` | |
86
+ | section | `String` | |
87
+ | language | `String` | |
88
+ | researchNotes | `String` | |
89
+ | databaseProvider | `String` | |
90
+ | database | `String` | |
91
+ | workType | `String` | |
92
+ | custom1 | `String` | |
93
+ | custom2 | `String` | |
94
+ | custom3 | `String` | |
95
+ | custom4 | `String` | |
96
+ | custom5 | `String` | |
97
+ | custom6 | `String` | |
98
+ | custom7 | `String` | |
99
+
100
+
101
+ Reference Types
102
+ ---------------
103
+ As with refs the following ref types are supported and translated from the module internal formats.
104
+
105
+
106
+ ```
107
+ aggregatedDatabase
108
+ ancientText
109
+ artwork
110
+ audioVisualMaterial
111
+ bill
112
+ blog
113
+ book
114
+ bookSection
115
+ case
116
+ catalog
117
+ chartOrTable
118
+ classicalWork
119
+ computerProgram
120
+ conferencePaper
121
+ conferenceProceedings
122
+ dataset
123
+ dictionary
124
+ editedBook
125
+ electronicArticle
126
+ electronicBook
127
+ electronicBookSection
128
+ encyclopedia
129
+ equation
130
+ figure
131
+ filmOrBroadcast
132
+ generic
133
+ governmentDocument
134
+ grant
135
+ hearing
136
+ journalArticle
137
+ legalRuleOrRegulation
138
+ magazineArticle
139
+ manuscript
140
+ map
141
+ music
142
+ newspaperArticle
143
+ onlineDatabase
144
+ onlineMultimedia
145
+ pamphlet
146
+ patent
147
+ personalCommunication
148
+ report
149
+ serial
150
+ standard
151
+ statute
152
+ thesis
153
+ unknown
154
+ unpublished
155
+ web
156
+ ```
157
+
158
+
159
+
160
+ API
161
+ ===
162
+ Each API is available either from the default `reflib` object or as a separate import.
163
+
164
+
165
+ ```javascript
166
+ import reflib from 'reflib'; // Import everything as `reflib`
167
+ reflib.readFile(path);
168
+ reflib.writeFile(path, refs);
169
+
170
+
171
+ import {readFile, writeFile} from 'reflib'; // Import specific functions
172
+ readFile(path);
173
+ writeFile(path, refs);
174
+ ```
175
+
176
+
177
+ formats
178
+ =======
179
+ Available: Node + Browser
180
+ A lookup object of all supported citation library formats.
181
+ Each key is the unique ID of that module.
182
+
183
+ Properties are:
184
+
185
+ | Key | Type | Description |
186
+ |--------------|-----------------|------------------------------------------------------------------------|
187
+ | `id` | `String` | The unique ID of that module (same as object key) |
188
+ | `title` | `String` | Longer, human readable title of the module |
189
+ | `titleShort` | `String` | Shorter, human readable title of the module |
190
+ | `ext` | `Array<String>` | Array of output file extensions, first extension should be the default |
191
+ | `canRead` | `boolean` | Whether the format is supported when reading a citation library |
192
+ | `canWrite` | `boolean` | Whether the format is supported when writing a citation library |
193
+
194
+
195
+ identifyFormat(path)
196
+ ====================
197
+ Available: Node + Browser
198
+ Attempt to determine the format of a file on disk from its path. The file does not need to actually exist.
199
+
200
+ ```javascript
201
+ identifyFormat('My Refs.csv') //= csv
202
+ identifyFormat('My Refs.json') //= json
203
+ identifyFormat('My Refs.nbib') //= nbib
204
+ identifyFormat('My Refs.txt.ris') //= ris
205
+ identifyFormat('MY REFS.TXT.RIS') //= ris
206
+ identifyFormat('My Refs.data.tsv') //= tsv
207
+ identifyFormat('My Refs.xml') //= endnoteXml
208
+ ```
209
+
210
+
211
+ readFile(path, options)
212
+ =======================
213
+ Available: Node
214
+ Read a file on disk, returning a Promise which will resolve with an array of all Refs extracted.
215
+
216
+ ```javascript
217
+ reflib.readFile('./data/json/json1.json')
218
+ .then(refs => /* Do something with Ref collection */)
219
+ ```
220
+
221
+ An emitter is available to track progress while reading. Note that due to the chainable nature of promises the first return contains the `emitter` key only:
222
+
223
+ ```javascript
224
+ let reader = reflib.readFile('./data/json/json1.json');
225
+
226
+ reader.emitter
227
+ .on('progress', ({readBytes, totalSize, refsFound}) => /* Report progress somehow */);
228
+ .on('end', ({refsFound}) => /* Report progress somehow */);
229
+
230
+ reader
231
+ .then(refs => /* Do something with Ref collection */)
232
+ ```
233
+
234
+ uploadFile(options)
235
+ ===================
236
+ Available: Browser
237
+ Prompt the user for a file and process it into an array of citations.
238
+
239
+ ```javascript
240
+ reflib.uploadFile({ // Additional options
241
+ file, // Optional File object if known, if omitted this function will prompt the user to select a file
242
+ onStart, // Async function called as `(File)` when starting the read stage
243
+ onProgress, // Function called as `(position, totalSize)` when processing the file
244
+ onEnd, // Async function called as `()` when the read stage has completed
245
+ })
246
+ .then(refs => /* Do something with Ref collection */)
247
+ ```
248
+
249
+
250
+ writeFile(path, refs, options)
251
+ ==============================
252
+ Available: Node
253
+ Write a file back to disk, returning a Promise which will resolve when done.
254
+
255
+ ```javascript
256
+ reflib.writeFile('MyRefs.xml', refs);
257
+ ```
258
+
259
+
260
+
261
+ readStream(moduleId, inputStream, options)
262
+ ==========================================
263
+ Available: Node + Browser
264
+ Low level worker of `readFile()`.
265
+ Accept an input Stream.Readable and return a emitter which will emit each Ref found.
266
+
267
+ ```javascript
268
+ reflib.readStream('json', createReadStream('./data/json/json1.json'))
269
+ .on('end', ()=> /* Finished reading */)
270
+ .on('error', err => /* Deal with errors */)
271
+ .on('ref', ref => /* Do something with extracted Ref */)
272
+ ```
273
+
274
+
275
+ writeStream(moduleId, outputStream, options)
276
+ ============================================
277
+ Available: Node + Browser
278
+ Low level worker of `writeFile()`.
279
+ Return an object with methods to call to write to a given stream.
280
+ The returned object will have a `start()`, `end()` and `write(ref)` (optional `middle(ref)`) function which can be called to write to the original input stream.
281
+
282
+ ```javascript
283
+ // Convert a JSON file to EndNoteXML via a stream
284
+ let output = reflib.writeStream('json', createWriteStream('./MyRefs.xml'));
285
+
286
+ output.start(); // Begin stream writing
287
+
288
+ reflib.readStream('json', createReadStream('./data/json/json1.json'))
289
+ .on('ref', ref => output.write(ref))
290
+ .on('end', ()=> output.end())
291
+ ```
292
+
293
+
294
+ Credits
295
+ =======
296
+ Developed for the [Bond University Institute for Evidence-Based Healthcare](https://iebh.bond.edu.au).
297
+ Please contact [the author](mailto:matt_carter@bond.edu.au) with any issues.