MCPcopy Create free account
hub / github.com/nodejs/node-addon-api / recurse

Function recurse

tools/check-napi.js:70–95  ·  view source on GitHub ↗
(top)

Source from the content-addressed store, hash-verified

68// Descend into a directory structure and pass each file ending in '.node' to
69// one of the above checks, depending on the OS.
70function recurse (top) {
71 fs.readdir(top, (error, items) => {
72 if (error) {
73 throw new Error('error reading directory ' + top + ': ' + error);
74 }
75 items.forEach((item) => {
76 item = path.join(top, item);
77 fs.stat(item, ((item) => (error, stats) => {
78 if (error) {
79 throw new Error('error about ' + item + ': ' + error);
80 }
81 if (stats.isDirectory()) {
82 recurse(item);
83 } else if (/[.]node$/.test(item) &&
84 // Explicitly ignore files called 'nothing.node' because they are
85 // artefacts of node-addon-api having identified a version of
86 // Node.js that ships with a correct implementation of N-API.
87 path.basename(item) !== 'nothing.node') {
88 process.platform === 'win32'
89 ? checkFileWin32(item)
90 : checkFileUNIX(item);
91 }
92 })(item));
93 });
94 });
95}
96
97// Start with the directory given on the command line or the current directory
98// if nothing was given.

Callers 1

check-napi.jsFile · 0.85

Calls 2

checkFileWin32Function · 0.85
checkFileUNIXFunction · 0.85

Tested by

no test coverage detected