question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fs.copyFileSync does not work for resources bundled in binaries

See original GitHub issue

To recreate

  1. Create a bundle and add a resource (e.g., ‘my-file’)
  2. In the binary, try to read and/or copy the resource to the external file system

What should happen

fs.readFileSync and fs.copyFileSync should both work.

What actually happens

Only fs.readFileSync works.

Example

This works:

const myFile = path.join(__dirname, 'my-file')
const contents = fs.readFileSync(myFile)

This doesn’t work:

const myFile = path.join(__dirname, 'my-file')
fs.copyFileSync(myFile, someExternalDirectory)

Note: This issue follows on from #605

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
TemaSMcommented, Apr 21, 2019

@paulocoghi, @calebboyd tested both these functions in production from current master branch, works fine as expected 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

NodeJS, fs.copyFileSync not working and not throwing error
I'm using the nodeJS class fs for copying files from a folder to another, using a loop. The problem is that this function...
Read more >
Nexe issue #607 appears to be fixed; refactor accordingly (#225 ...
Nexe issue fs.copyFileSync does not work for resources bundled in binaries appears to be fixed. We should confirm and refactor accordingly.
Read more >
Node.js fs.copyFileSync() Function
The fs.copyFileSync() method is used to synchronously copy a file from the source path to destination path. Node.js will overwrite the file ...
Read more >
Node.js v19.3.0 Documentation
Indicates the failure of an assertion. All errors thrown by the node:assert module will be instances of the AssertionError class. new assert.AssertionError( ...
Read more >
Configure the create-react-app public URL post-build with ...
The frontend of that application is built with create-react-app which is ... that is bundled as a binary and each user should be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found