Skip to content

Commit

Permalink
[flatbuffers] Fix wrong usage of fs.readdirSync() in Node 20
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Oct 26, 2023
1 parent 3dd69b5 commit 30ab493
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions npm-scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ function replaceVersion()
const files = fs.readdirSync('node/lib',
{
withFileTypes : true,
recursive : false
recursive : true
});

for (const file of files)
Expand All @@ -289,7 +289,8 @@ function replaceVersion()
continue;
}

const filePath = path.join('node/lib', file.name);
// NOTE: dirent.path is only available in Node >= 20.
const filePath = path.join(file.path ?? 'node/lib', file.name);
const text = fs.readFileSync(filePath, { encoding: 'utf8' });
const result = text.replace(/__MEDIASOUP_VERSION__/g, PKG.version);

Expand Down

0 comments on commit 30ab493

Please sign in to comment.