Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
vfile-find-up
Advanced tools
vfile utility to find one or more files by searching the file system upwards
vfile utility to find files by searching the file system upwards.
This utility lets you find one or many files upwards.
You can use this utility if you want to find, say, a config file.
If you instead want to find files downwards, such as all markdown files in a
folder, you can use vfile-find-down
.
This package is ESM only. In Node.js (version 14.14+ and 16.0+), install with npm:
npm install vfile-find-up
import {findUp} from 'vfile-find-up'
console.log(await findUp('package.json'))
Yields:
[ VFile {
data: {},
messages: [],
history: [ '/Users/tilde/projects/oss/vfile-find-up/package.json' ],
cwd: '/Users/tilde/projects/oss/vfile-find-up' } ]
This package exports the identifiers
BREAK
,
INCLUDE
,
findUp
, and
findUpOne
.
There is no default export.
findUp(tests[, path][, callback])
Find files or folders upwards.
👉 Note: files are not read (their
value
is not populated).
(test[, path], callback) => void
(test[, path]) => Promise<Array<VFile>>
test
(Test
)
— things to search forpaths
(string
, default: process.cwd()
)
— place to search fromcallback
(Callback
, optional)
— callback called when doneNothing when callback
is given (void
), otherwise a promise that resolves to
files (Array<VFile>
).
findUpOne(test[, path][, callback])
Find the first file or folder upwards.
👉 Note: files are not read (their
value
is not populated).
(test[, path], callback) => void
(test[, path]) => Promise<VFile>
test
(Test
)
— things to search forpath
(string
, default: process.cwd()
)
— place to search fromcallback
(CallbackOne
, optional)
— callback called when doneNothing when callback
is given (void
), otherwise a promise that resolves to
a file (VFile | null
).
BREAK
Stop searching (number
).
INCLUDE
Include this file (number
).
Assert
Handle a file (TypeScript type).
file
(VFile
)
— file to handleHow to handle this file (boolean | number
, optional).
true
is treated as INCLUDE
.
Callback
Callback called when done (TypeScript type).
error
(Error | null
)
— error; errors are currently never passedfiles
(Array<VFile>
)
— filesNothing (void
).
CallbackOne
Callback called when done finding one file (TypeScript type).
error
(Error | null
)
— error; errors are currently never passedfile
(VFile | null
)
— fileNothing (void
).
Test
Things to search for (TypeScript type).
For strings, the basename
or extname
of files must match them.
For arrays, any test in them must match.
type Test = Array<Assert | string> | Assert | string
This package is fully typed with TypeScript.
It exports the additional types
Assert
,
Callback
,
CallbackOne
, and
Test
.
Projects maintained by the unified collective are compatible with all maintained versions of Node.js. As of now, that is Node.js 14.14+ and 16.0+. Our projects sometimes work with older versions, but this is not guaranteed.
See contributing.md
in vfile/.github
for ways to
get started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
FAQs
vfile utility to find one or more files by searching the file system upwards
The npm package vfile-find-up receives a total of 0 weekly downloads. As such, vfile-find-up popularity was classified as not popular.
We found that vfile-find-up 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.