-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(csv-parse): call destroy on end (fix #410)
- Loading branch information
Showing
8 changed files
with
97 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
import * as stream from 'node:stream/promises' | ||
import { generate } from 'csv-generate' | ||
import { parse } from '../lib/index.js' | ||
|
||
describe 'API stream.iterator', -> | ||
|
||
it 'classic', -> | ||
parser = generate(length: 10).pipe parse() | ||
records = [] | ||
for await record from parser | ||
records.push record | ||
records.length.should.eql 10 | ||
|
||
it 'with iteractor stoped in between', -> | ||
# See https://github.com/adaltas/node-csv/issues/333 | ||
# See https://github.com/adaltas/node-csv/issues/410 | ||
# Prevent `Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close` | ||
records = [] | ||
parser = generate(length: 10).pipe parse | ||
to_line: 2 | ||
records = [] | ||
for await record from parser | ||
records.push record | ||
records.length.should.eql 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters