Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
check-files-exist
Advanced tools
Checks if the given array of file selectors or single selector resolves to a file.
Weekly downloads
Readme
This small promise based node module checks a given string or array of strings to contain valid file selectors. The selectors could either be relative or absolute paths or even globs.
var checkFilesExist = require('check-files-exist');
checkFilesExist(['files/a.js', 'files/*_c.js'], __dirname).then(function () {
console.log('All files exist.');
}, function (err) {
console.log(err);
})
Let's assume, we've got the following directory structure:
+ files
- a.js
- b_c.js
- d.js
Each of the following calls would resolve the promise:
checkFilesExist('files/*')
checkFilesExist('files/**/*')
checkFilesExist('files/a.js')
checkFilesExist(['files/a.js', 'files/d.js'])
checkFilesExist(['files/a.js', ['files/*_c.js']])
checkFilesExist(['files/a.js', ['files/*_c.js', 'files/b_*']])
checkFilesExist([['files/a.js'], ['files/*_c.js', 'files/b_*']])
The following would reject it:
checkFilesExist('')
checkFilesExist('files/_*')
checkFilesExist([])
checkFilesExist(['files/', ''])
Using this module in f.e. gulp is really simsple:
gulp.task('checkFilesExist', function() {
return checkFilesExist([
config.scripts.files,
]);
});
node-glob provides passing a cwd
working directory string. You could easily pass a string as a second parameter to have it passed to glob:
checkFilesExist('files/a.js', __dirname).then(...);
FAQs
Checks if the given array of file selectors or single selector resolves to a file.
The npm package check-files-exist receives a total of 42 weekly downloads. As such, check-files-exist popularity was classified as not popular.
We found that check-files-exist demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.