Problem with path on windows


I am currently working on a project and am trying to read in a large file using event-streams. My friend implemented the following code using mac and it runs on his side without a problem.

            .createReadStream(`${process.env.PWD}/private/rutgers_map_v3/RUMapv3_B137_chr` + i + `.txt`)
            .on('data', function (chunk) {
                const stringify = chunk.toString();
            .on('end', async function () {
                console.log('Finished Reading files');
            .on('error', async function (err) {

However, when I try to run the same code, I get the following error:

 { Error: ENOENT: no such file or directory, open 'C:\Users\DELL\AppData\Local\Temp\meteor-test-runxkmr0u.vrdd\.meteor\local\build\programs\server\undefined\private\rutgers_map_v3\RUMapv3_B137_chr21.txt'

My guess is that my meteor executable is on a different directory. I currently have it on C:/Users/DELL/AppData/Local/.meteor/meteor.bat. The file exists in the same location for both of us.
Sorry if this is a silly question, Iā€™m still starting out! Thank you for reading this and any help is greatly appreciated.


The problem here is that Windows uses the backslash path separator. Check this article for guidance on how to ensure your code is compatible between Windows and *nix (including OSX).

1 Like

Also you can get the path or contents of a file in private/ using Assets