
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
Modern and light-fast CLI app that scans all the desired files of a certain folder and returns a list with the name of the files which contain a RegEx pattern
Modern and light-fast CLI app that scans all the desired files of a certain folder and returns a list with the name of the files which contain a RegEx pattern.
pate is a library that, given a RegExp pattern and a folder path, filters out every nested file in that folder which doesn't match the pattern. Optionally it's possible either to write the list of files that match to a file, to log every single action that's happening internally, or even to filter the files via a glob pattern.
Currently it isn't fully tested, so I'd be glad to receive PRs that enhance the current test suite.
It requires at least NodeJS 8.5.0 installed. To the Windows users: the CLI app has a better UX if you use Git Bash.
To install the library:
With yarn:
yarn add pateOr, with npm:
npm i -S pateTo install the CLI app:
With yarn:
yarn global add pateOr, with npm:
npm i -g pateI wanted to demonstrate a non-trivial use case for NodeJS' WriteStream and ReadStream API, while writing a solid and extensible library which might be actually useful for somebody. Also, I wanted it to be as fast as possible, and I also took time to make the command line interface to be as user friendly as possible.
$ pate --help output:
Usage: pate [-v|--verbose] [-o|--output FILE] [-g|--glob 'glob pattern']
[-i|--ignore 'ignore pattern'] -m [MATCHPATTERN] -p [PATH]
Options:
--help Show help [boolean]
--version Show version number [boolean]
-m, --match match pattern to look for in the files located in PATH
[required]
-p, --path path where files will be collected [required]
-g, --glob Filter files in PATH via a glob pattern. Note: it needs quotes
to be properly parsed. [default: "*.*"]
-o, --output file which will contain the list of the files in PATH that
match MATCHPATTERN
-v, --verbose Show current operation details in real-time
[boolean] [default: false]
-i, --ignore pattern that defines folders or files to exclude from the
discovery [array] [default: []]
Examples:
pate To look for every 'require' word in the js files inside node_modules,
saving the result to result.txt, you'd do:
pate -g '*.js' -o result.txt -m require -p ./node_modules
Developed by jkomyno - Copyright 2017
Submit issues at https://github.com/jkomyno/pate
Note that glob patterns always require to be quoted (suggestion: use single quotes), while match patterns only need quotes when you're using RegEx specific syntax.
list all md files in ./node_modules which contain the sequence of characters awesome
$ pate -p ./node_modules -m awesome -g '*.md' -vlist all *.d.ts files in ./node_modules/@types which contain the word extends
$ pate -p ./node_modules/@types -m 'extends\b' -g '*.d.ts' -vlist all *.js files in /absolute/path which contain the RegEx pattern a?b+$, and redirect the list to ./found.txt
$ pate -p /absolute/path -m 'a?b+$' -g '*.js' -o ./found.txtlist all files whose extension is js or ts in ./node_modules, which contain either the word reduce or map, redirect the list to ./found.txt while ignoring every index.js or index.ts file
$ pate -p ./node_modules -m 'reduce\b|map\b' -g '*.+(js|ts)' -i '**/index.+(js|ts)' -o ./found.txtAs always, contributions are always welcome, and remember:
buildtraspiles the .ts files in ./src to a brand new ./dist folder
build:watch - run build process in watch-modeflowchecks if Flow definitions are written properly
lintchecks if code conforms to linting rules (tslint)
lint --fix - will automatically fix ts filespublishRuns all the linting/test suites Creates a brand new build Pushes a release to npm
testchecks if all unit tests pass (jest / ts-jest)
test:watch - run tests in watch-modetest:cov - run tests and displays coverageThis project is MIT licensed.
FAQs
Modern and light-fast CLI app that scans all the desired files of a certain folder and returns a list with the name of the files which contain a RegEx pattern
We found that pate 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.