Skip to content
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

Question: fs implementation? #72

Open
amilajack opened this issue Oct 20, 2017 · 2 comments
Open

Question: fs implementation? #72

amilajack opened this issue Oct 20, 2017 · 2 comments

Comments

@amilajack
Copy link

amilajack commented Oct 20, 2017

What is holding back adding an fs polyfill? I've seen many implementations for browser fs polyfills for node:

Seems possible. Any reasons why this hasnt been done yet? I can PR for this.

@goto-bus-stop
Copy link
Contributor

I don't think there's a one-size-fits-all browser fs polyfill. a readFile call in the browser may have to do a request to a server like in BrowserFS, if the file is a template or image resource. If the file is a user configuration file, using a client-side store like browserify-fs makes more sense. that makes it difficult to pick a single polyfill.

@ORESoftware
Copy link

I have my own fs polyfill, just for reference, it's here:

https://github.com/sumanjs/suman-browser-polyfills/blob/master/modules/fs.js

I generated it by looping through all the fs methods and just allowing for both a synchronous return and a callback. It seems to work ok, was quick and dirty.

Here is how I generated it:
https://github.com/sumanjs/suman-browser-polyfills/blob/master/lib/src/fs.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants