mapbox / mapbox/csv2geojson

Cannot create a string longer than 0x1fffffe8 characters

Open
#79 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
373
Forks
80
PR merge metrics
No merged PRs in 30d

Description

So... it would seem that the code tries to slurp the whole file into memory in one go, and convert it to one big string. That's not a good idea....

```
Error: Cannot create a string longer than 0x1fffffe8 characters
at Buffer.toString (node:buffer:784:17)
at convert (C:\Users\chris\GITW\nsldist\client\node_modules\csv2geojson\csv2geojson:23:34)
at ConcatStream. (C:\Users\chris\GITW\nsldist\client\node_modules\concat-stream\index.js:36:43)
at ConcatStream.emit (node:events:402:35)
at finishMaybe (C:\Users\chris\GITW\nsldist\client\node_modules\readable-stream\lib\_stream_writable.js:475:14)
at endWritable (C:\Users\chris\GITW\nsldist\client\node_modules\readable-stream\lib\_stream_writable.js:485:3)
at ConcatStream.Writable.end (C:\Users\chris\GITW\nsldist\client\node_modules\readable-stream\lib\_stream_writable.js:455:41)
at ReadStream.onend (node:internal/streams/readable:693:10)
at Object.onceWrapper (node:events:509:28)
at ReadStream.emit (node:events:390:28) {
code: 'ERR_STRING_TOO_LONG'
}```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the convert call shown at node_modules/csv2geojson:23:34 and inspect how concat-stream supplies the file contents. Reproduce the failure with an input exceeding Node's string limit; done means oversized CSV files no longer fail with ERR_STRING_TOO_LONG.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.