Does not work with empty files
yuri-karadzhov opened this issue · 0 comments
yuri-karadzhov commented
Stream will never be ended if cached content is empty
const cache = require('streaming-cache');
const {Readable} = require('stream');
const cache = new Cache;
...
new Readable({
read() {
this.push(''); // Empty content
this.push(null);
},
}).pipe(cache.set(key));
ctx.body = cache.get(key);