Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Recursively watch a list of directories & run a command on any file system changes
fs.watch
wrapper†† While
fs.watch
has its inconsistencies, efforts are made to normalize behavior across platforms.
$ npm install --save-dev watchlist
CLI
# Run `npm test` on changes within "src" and "test" contents change
$ watchlist src test -- npm test
# Run `npm test` on changes within "packages", ignoring /fixtures/i
$ watchlist packages --ignore fixtures -- npm test
# Run `lint` script on ANY change
$ watchlist -- npm run lint
API
import { watch } from 'watchlist';
async function task() {
console.log('~> something updated!');
await execute_example(); // linter, tests, build, etc
}
// Run `task()` when "{src,test}/**/*" changes
// Must also ignore changes to any `/fixture/i` match
await watch(['src', 'test'], task, {
ignore: 'fixtures'
});
The watchlist
binary expects the following usage:
$ watchlist [...directory] [options] -- <command>
Important: The
--
is required! It separates yourcommand
from yourwatchlist
arguments.
Please run watchlist --help
for additional information.
Returns: Promise<void>
Watch a list of directories recursively, calling handler
whenever their contents are modified.
Type: Array<String>
The list of directories to watch.
May be relative or absolute paths.
All paths are resolved from the opts.cwd
location.
Type: Function
The callback function to run.
Note: This may be a Promise/
async
function. Return values are ignored.
Type: String
Default: .
The current working directory. All paths are resolved from this location.
Defaults to process.cwd()
.
Type: String
or RegExp
or Array<String | RegExp>
A list of patterns that should not be watched nor should trigger a handler
execution.
Ignore patterns are applied to file and directory paths alike.
Note: Any
String
values will be converted into aRegExp
automatically.
Type: Boolean
Default: false
Whether or not the console
should be cleared before re-running your handler
function.
Note: Defaults to
true
for the CLI! Pass--no-clear
to disable.
Type: Boolean
Default: false
When enabled, runs the command
one time, after watchlist
has initialized. When disabled, a change within the dirs
list must be observed before the first command
execution.
Returns: Promise<void>
All arguments to watchlist.run
are passed to child_process.exec
directly.
Note: Any
stdout
orstderr
content will be piped/forwarded to your console.
Type: String
The command string to execute.
View child_process.exec
for more information.
Type: String
Additional child_process.exec
arguments.
Important: The
callback
argument is not available!
MIT © Luke Edwards
FAQs
Recursively watch a list of directories & run a command on any file system changes
We found that watchlist 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.