Open ramasamymohan opened 8 years ago
Hi!
As you've found, the sharpCache
option maps directly to http://sharp.dimens.io/en/stable/api/#sharpcacheoptions -- but unfortunately libvips' operation cache only applies to files loaded from disc, which doesn't happen with express-processimage, because it uses the stream-based input. In cases where express-processimage sits directly on top of eg. the static middleware, that's probably a bit silly, especially if you'd like for the caching to work :)
We could consider introducing a mode where express-processimage takes control of loading the file from disc and hands the file name to the image libs, thus enabling the use of the sharp cache. Would that fix your use case?
I appreciate your quick reply. It would be great if a mode can enable sharp cache and if express-processimage could take control to load the image from disc.
Thank you.
Okay, thanks. I might look into implementing that when I get around to integrate https://github.com/papandreou/impro -- I can't make any guarantees about when that will happen, though.
I was trying to use sharpCache option to cache images,
app.use(processImage({ root: 'public', sharpCache: { items: 200,files: 30 } }));
If sharpCache option is not given I think it should take default sharp cache option. Is sharpCache option working?
Everytime, when an image is processed through url query string it uses more cpu. If it can cache it in file system, I believe it can process image faster. Any idea?
Thank you.