Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

JSONStream.stringify doesn't work on a huge JSON object #164

Open
andy51002000 opened this issue Sep 3, 2018 · 0 comments
Open

JSONStream.stringify doesn't work on a huge JSON object #164

andy51002000 opened this issue Sep 3, 2018 · 0 comments

Comments

@andy51002000
Copy link

andy51002000 commented Sep 3, 2018

I was going to convert a huge JSON object to string by JSONStream.stringify but got error below
How can I fix this problem?

Unhandled rejection RangeError: Invalid string length
at Object.stringify (native)
at Stream. (/app/node_modules/JSONStream/index.js:194:23)
at Stream.stream.write (/app/node_modules/through/index.js:26:11)

  var transStream = JSONStream.stringify(false);
    transStream.pipe(
        req({
            url: `${process.env.ENDPOINT}`,
            method: 'POST',
            encoding: null
        }, (error, response, body) => {
            if (error) {
                console.log('Error sending message: ', error)
            } else {
                console.log('Response: ', response.body)
            }
        })
    );
    transStream.write(model);
    transStream.end();
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant