Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
vfile-find-down
Advanced tools
Find one or more files (exposed as VFiles) by searching the file system downwards.
npm:
npm install vfile-find-down
Require dependencies:
var findDown = require('vfile-find-down');
Search for files with a .md
extension from the current working directory
downwards:
findDown.all('.md', console.log);
/* null [ VFile {
* contents: '',
* messages: [],
* history: [ '/Users/foo/bar/baz/example.md' ],
* directory: '/Users/foo/bar/baz',
* filename: 'example',
* extension: 'md' },
* VFile {
* contents: '',
* messages: [],
* directory: '/Users/foo/bar/baz',
* filename: 'readme',
* extension: 'md' } ]
*/
Search for the first file:
findDown.one('.md', console.log);
/* null VFile {
* contents: '',
* messages: [],
* directory: '/Users/foo/bar/baz',
* filename: 'example',
* extension: 'md' }
*/
Find a file or a directory downwards.
Example
findDown.one('readme.md', console.log);
/* null VFile {
* contents: '',
* messages: [],
* history: [ '/Users/foo/bar/baz/readme.md' ],
* directory: '/Users/foo/bar/baz',
* filename: 'readme',
* extension: 'md' }
*/
Signatures
findDown.one(filePath[, paths], callback)
;findDown.one(extension[, paths], callback)
;findDown.one(test[, paths], callback)
;findDown.one(tests[, paths], callback)
.Parameters
filePath
(string
)
— Filename (including extension) to search for;
extension
(string
)
— File extension to search for (must start with a .
);
test
(Function
)
— Function invoked to check whether a virtual file should be included;
tests
(Array.<Function|filePath|extension>
)
— List of tests, any of which should match a given file for it to
be included.
paths
(Array.<string>
or string
, optional, default: process.cwd()
)
— Place(s) to start searching from;
callback
(Function
);
— Function invoked when a matching file or the top of the volume
is reached.
Notes
content
is not populated).Invoked when a matching file or the top of the volume is reached.
Parameters
err
(Error
, optional);file
(VFile
, optional).Notes
err
parameter is never populated.Find files or directories downwards.
Example
findDown.all('.md', console.log);
/* null [ VFile {
* contents: '',
* messages: [],
* directory: '/Users/foo/bar/baz',
* filename: 'example',
* extension: 'md' },
* VFile {
* contents: '',
* messages: [],
* directory: '/Users/foo',
* filename: 'readme',
* extension: 'md' } ]
*/
Signatures
findDown.all(filePath[, paths], callback)
;findDown.all(extension[, paths], callback)
;findDown.all(test[, paths], callback)
;findDown.all(tests[, paths], callback)
.Parameters
filePath
(string
)
— Filename (including extension) to search for;
extension
(string
)
— File extension to search for (must start with a .
);
test
(Function
)
— Function invoked to check whether a virtual file should be included;
tests
(Array.<Function|filePath|extension>
)
— List of tests, any of which should match a given file for it to
be included.
paths
(Array.<string>
or string
, optional, default: process.cwd()
)
— Place(s) to start searching from;
callback
(Function
);
— Function invoked when matching files or the top of the volume
is reached.
Notes
content
is not populated).Invoked when files or the top of the volume is reached.
Parameters
err
(Error
, optional);files
(Array.<VFile>
, optional).Notes
err
parameter is never populated.Check whether a virtual file should be included.
Parameters
file
(VFile
).Returns: boolean
, when truthy, the file is included.
Flag used as an alternative to returning true
from
test
, ensuring the tested file
is included and passed to callback
.
Flag used to skip searching a directory from test
.
Flag used to stop searching for files from test
.
FAQs
vfile utility to find one or more files by searching the file system downwards
We found that vfile-find-down demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.