observablehq / feedback

Customer submitted bugs and feature requests
42 stars 3 forks source link

Add ndjson FileAttachment reading capability #545

Open hrbrmstr opened 1 year ago

hrbrmstr commented 1 year ago

Is your feature request related to a problem? Please describe. While .json() is useful for FileAttachment it does not handle newline-delimited JSON (ndjson). Handling it would save folks from having to either convert ndjson to a JSON array or uses a separate function after using FileAttachment(…).text().

Describe the solution you'd like To be able to just runFileAttachment(…).ndjson()

Describe alternatives you've considered I've been using a function in a small JS library I have, but I think this would be useful to the stdlib.

Additional context I've tossed together what this code might look like in this commit in a stdlib fork. I'd be glad to submit a PR, but the additions are fairly trivial to just replicate by someone.