[RFC]: add `@stdlib/fs/read-ndjson`
Description
This RFC proposes adding a filesystem utility to read a file which is newline-delimited JSON (NDJSON).
Package: @stdlib/fs/read-ndjson
Alias: readNDJSON
Related Issues
The following RFC is a prerequisite to being able to implement this feature:
- https://github.com/stdlib-js/stdlib/issues/1075
Questions
No.
Other
For a reference package, see
Checklist
- [X] I have read and understood the Code of Conduct.
- [X] Searched for existing issues and pull requests.
- [X] The issue name begins with
RFC:.
@kgryte Hey, I can take it up after #1075 gets merged. I've already made PR for #1075.
@maniksharma17 Yes, that seems like a natural follow-up. I'll go ahead and assign you.
Hey @kgryte @Planeshifter , if no one is working on this issue , can I take this?
@Pratik772846 Hey, parse-ndjson got merged a day ago. I've started working on this one.
Can I work on these issue if no one is working
@yaswanthkosuru , I've been working on this, i can raise a PR by the weekend. Thank you.
@yaswanthkosuru please feel free to take over this as i cannot come up with a solution as of now
@aayush0325 May I know the challenges you faced so that i will help if possible or it can help me
@yaswanthkosuru I couldn't write accurate examples for this as I am not familiar with ndjson spec, tried reading about it but it really didn't work out. my index.js in examples was giving expected output when i manually ran it via Node.js but it was giving errors while i tried committing it
ok it seems like there is knowledge gap .i can take these issue .Thank u FYI:Examples look like in fs/readjson but here it can Parse \n lines also Intial Thoughts:Package look like @stdlib/fs/read-json,use parsendjson to parse
yup i tried, all the best!!!
I don't think you need to support a separate *.ndjson filename extension. Just use *.json.
@kgryte
@Planeshifter
var readNDJSON = require( '@stdlib/fs/read-ndjson' );
readNDJSON("package.json")=>returns content
readNDJSON("package.ndjson")=>returns content
is package needs to support both file formats like above?
if above is the case, @stdlib/utils/parse-ndjson can only parse ndjson.
Then Based on file name we can use parsejson or parsenjson to parse content.
How ever i dont think it is good to go with *.json. correct me if am wrong.
No, the filename extension has no bearing here. As a user, I should be able to provide a file path having any extension and the described APIs should read the file contents and attempt to parse as NDJSON. So again, we do not need to add support for a specific ndjson filename extension. The same has been true of other packages (eg, read-json, read-wasm); none of those packages care about what the filename extension is, nor should they.