The most popular example I have seen of using stream_in
with a custom handler uses stream_out
to write the processed json to a file connection. It is not clear to me how to write a custom handler that would store all pages processed using my custom handler logic and binds them into a single data frame to be returned, as the default handler does.
The following example returns NULL:
library(jsonlite)
handler <- function(df){
# process df and store in result
...
return(result)
}
x <- stream_in(file_connection, simplifyVector = FALSE, handler = handler)
# x is NULL
Is there a way to bind the result from multiple handler calls without writing intermediate results to disk?