serve-static
serve-static copied to clipboard
Enable use with memory-fs
I am producing all the files and storing them only in memory, i.e. https://github.com/webpack/memory-fs. I'd like there to be an option to tell serve-static which fs to use.
Does that module actually implement enough of the features to work here? I didn't look at it immediately but I remember at least one previous issue about this. Of course, please feel so inclined to make a PR in which you think the ideal implementation should be. This module does not require(fs) anywhere, so the change here is not obvious to me.
This module does not require(fs) anywhere, so the change here is not obvious to me.
serve-static is using send to read-stream files.
https://github.com/expressjs/serve-static/blob/f75f96908b3b4add99352a59af13560859a1b10a/index.js#L96
Bummer. This would require modification of send as well as serve-static.
I see that send is using only stat and createReadStream. memory-fs implements these methods.
Supporting this feature would require send to introduce a factory abstraction.
This is too low of a priority for me to champion such change. I will rather simply write to the disk and continue using serve-static.
Lets leave this open and see if more people require this feature. I am sensing it might be an edge use case.
I have the same issue. Is there any way to provide fs module?
Highly related #pillarjs/send/issues/160