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

fix: CreateOptions.transform should return stream #195

Merged
merged 3 commits into from
Mar 31, 2020
Merged

fix: CreateOptions.transform should return stream #195

merged 3 commits into from
Mar 31, 2020

Conversation

toyobayashi
Copy link
Contributor

According to lib/filesystem.js#L65-L80

const transformed = options.transform && options.transform(p)
if (transformed) {
  const tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), 'asar-'))
  const tmpfile = path.join(tmpdir, path.basename(p))
  const out = fs.createWriteStream(tmpfile)
  const readStream = fs.createReadStream(p)

  await pipeline(readStream, transformed, out)
  file.transformed = {
    path: tmpfile,
    stat: await fs.lstat(tmpfile)
  }
  size = file.transformed.stat.size
} else {
  size = file.stat.size
}

Copy link
Member

@malept malept left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good catch.

lib/index.d.ts Show resolved Hide resolved
@toyobayashi toyobayashi requested a review from malept March 31, 2020 00:08
@malept
Copy link
Member

malept commented Mar 31, 2020

For some reason CI isn't working on this PR.

@toyobayashi
Copy link
Contributor Author

anything i can help?

@malept malept merged commit c9cc0a1 into electron:master Mar 31, 2020
@electron-bot
Copy link

🎉 This PR is included in version 3.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

3 participants