Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
The 'fined' npm package is a utility that helps in finding files or directories based on a specified pattern or path. It is particularly useful for locating configuration files within projects or modules by providing a flexible way to specify search criteria and paths.
File Searching
This feature allows users to search for files with specific names and extensions within a given directory. The code sample demonstrates how to search for 'config.json' or 'config.js' in the current directory.
const fined = require('fined');
const result = fined({path: '.', extensions: ['.json', '.js']}, {name: 'config'});
console.log(result);
Custom Path and Extension Resolution
This feature enables the customization of search paths and file extensions, including the ability to search parent directories ('findUp' option). The example searches for 'app.config' or 'app.cfg' in the 'configs' directory or upwards.
const fined = require('fined');
const pathSpec = {path: 'configs', extensions: ['.config', '.cfg'], findUp: true};
const result = fined(pathSpec, {name: 'app'});
console.log(result);
Similar to 'fined', 'find-up' allows users to find files by walking up parent directories. It is simpler in usage compared to 'fined' which offers more detailed configuration options like multiple extensions and specific directory paths.
While 'glob' is primarily used for pattern matching on filenames, it shares the file searching capability with 'fined'. Unlike 'fined', 'glob' supports complex patterns but does not have built-in support for prioritizing specific file extensions or names.
Find a file given a declaration of locations.
var fined = require('fined');
fined({ path: 'path/to/file', extensions: ['.js', '.json'] });
// => { path: '/absolute/path/to/file.js', extension: '.js' } (if file exists)
// => null (if file does not exist)
var opts = {
name: '.app',
cwd: '.',
extensions: {
rc: 'default-rc-loader',
'.yml': 'default-yml-loader',
},
};
fined({ path: '.' }, opts);
// => { path: '/absolute/of/cwd/.app.yml', extension: { '.yml': 'default-yml-loader' } }
fined({ path: '~', extensions: { rc: 'some-special-rc-loader' } }, opts);
// => { path: '/User/home/.apprc', extension: { 'rc': 'some-special-rc-loader' } }
pathObj [string | object] : a path setting for finding a file.
opts [object] : a plain object supplements pathObj
.
pathObj
and opts
can have same properties:
path
and for finding up.This function returns a plain object which consists of following properties if a file exists otherwise null.
MIT
FAQs
Find a file given a declaration of locations.
The npm package fined receives a total of 2,790,461 weekly downloads. As such, fined popularity was classified as popular.
We found that fined demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.