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

CacheStream.getCache returns empty array in Node.js v14 #194

Closed
yoshinorin opened this issue Apr 23, 2020 · 3 comments · Fixed by #195
Closed

CacheStream.getCache returns empty array in Node.js v14 #194

yoshinorin opened this issue Apr 23, 2020 · 3 comments · Fixed by #195

Comments

@yoshinorin
Copy link
Member

yoshinorin commented Apr 23, 2020

refs: hexojs/hexo#4260

Node.js v14 the hexo-util@ChachStream.getCache returns an empty array.

In Node.js v14 has many changes about stream. I think this issue caused by these changes.

@curbengh curbengh changed the title ChachStream.getCache returns empty array in Node.js v14 CacheStream.getCache returns empty array in Node.js v14 Apr 24, 2020
@curbengh
Copy link
Contributor

curbengh commented Apr 24, 2020

Can you attach a sample code? Following code works for me in Node 14,

const { CacheStream } = require('hexo-util');
const { createReadStream } = require('fs')

const stream = new CacheStream();
createReadStream('testfile').pipe(stream)

stream.on('finish', () => {
  console.log(stream.getCache().toString());

  stream.destroy();
});

@stevenjoezhang stevenjoezhang linked a pull request Apr 24, 2020 that will close this issue
@yoshinorin
Copy link
Member Author

yoshinorin commented Apr 24, 2020

Last night, I added console.log(this._cache) in getCache method in my local env after that I confirmed this phenomenon when I exec hexo@generate.js test.

I think this issue caused by destroy method.

@SukkaW
Copy link
Member

SukkaW commented Apr 25, 2020

@yoshinorin

Confirmed that the issue could be fixed by #195.
Verified in hexojs/hexo#4264

@SukkaW SukkaW closed this as completed Apr 25, 2020
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

Successfully merging a pull request may close this issue.

3 participants