You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fetch("https://example.com/data.json").then(res=>res.text()).then(data=>devalue.parse(data))// Works
So I think it would be nice if devalue.parse could accept a ReadableStream as well so that we can do something like one of the two below
fetch("https://example.com/data.json").then(res=>devalue.parse(res))// This probably is the wrong way to approach it, not sure// similarly.then(res=>res.devalueParse())
or alternatively
// via stream chunkingfetch("https://example.com/data.json").then(res=>{res.body.pipe(devalueParser);devalueParser.on('error',function(error){});devalueParser.on('readable',function(){letstream=this;// `this` is from `devalueParser`, which is a streamletitem;letchunks=[];while(item=stream.read())chunks.push(item);returnchunks;});})
I can see some obvious dumbness in my examples but the general idea is to be able to use a stream parser to not have to wait for the text and then parse it
The text was updated successfully, but these errors were encountered:
plutoniumm
changed the title
Allow ReadableStreams for parse (or maybe even stringify idk)
Allow ReadableStreams for parseFeb 26, 2023
I have a ServerSide JSON file that was encoded with devalue.stringify since it has Maps, doing a fetch call to it with .json doesn't work i.e consider
But if I do (workaround)
So I think it would be nice if
devalue.parse
could accept aReadableStream
as well so that we can do something like one of the two belowor alternatively
I can see some obvious dumbness in my examples but the general idea is to be able to use a stream parser to not have to wait for the text and then parse it
The text was updated successfully, but these errors were encountered: