-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Major API revision #116
Comments
Actually that was my initial expectation after starting to use this amazing library. For example when creating a file (and not reading the documentation carefully), I was expecting to receive back a "handle" that would let apply further operations over that file. Totally supporting this change 👍 |
I just discovered the project (much to my delight) after bashing out a first pass at a similar utility for my own projects. It might be out of scope, but one significant enhancement would be support for additional “smart” read/write formats beyond json. Json5, JSONLD, csv/tsv, and toml files are examples; perhaps a config object with file extensions mapped to callbacks, passed on when creating a fresh jetpack instace? other than that, the changes you describe sound excellent. |
Thank you @eaton Regarding status of the project. Right now my biggest problem is that I've changed my career and stopped programming completely. Hopefully incoming winter will force me to contribute again to this project :) |
Congratulations on escaping the world of software, hopefully you're busy raising goats while the rest of us growl about CJS/ESM problems. ;D Regarding the "everyone would have to download extra libraries" problem, I definitely agree that hard-coding the long list of formats would be a problem. I was thinking something along the lines of "A way to add async callbacks to process specific file extensions during read and write operations" — something along the lines of:
It would require the write and read functions to check for matching handlers based on the file extension they're given, but if that approach seems like it would fit with philosophy of the library, I'm happy to turn the work I'm doing into a patch. |
Hello all fs-jetpack users. This project is few years old now, and there are ideas in my head of things that I wish had been done differently from the beginning. I'm thinking about major revision of the API, that will be more logical and elegant.
This is very early idea and can be killed if there is enough push back, so your voice counts :)
One: The library right now has the concept of “directory object”, but is lacking “file object” and I’d love to be able to do sometimes things like:
Two: I was aiming for very elegant API, that just reads well. So for example current way to make empty directory:
Can be described in more human readable form:
Three: The API can actually be smaller and less clunky. For instance the concept of
.cwd()
actually is not necessary for API to work, and brings confusion withprocess.cwd()
.So. Finally. The main idea is that there are two main methods:
Those methods don’t do any disk I/O, they just create javascript object representing given path on disk. Next you interact with directory or file under given path by calling sync or async methods on corresponding object. Fully OOP :)
A lot of the methods would be the same on
dir
andfile
object, just file won’t take the path as a parameter. So those two lines would be equivalents:What do you think?
Do you find some parts of the current API irritating?
The text was updated successfully, but these errors were encountered: