Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
require-resolve
Advanced tools
Use the node way to resolve required path to absolute path.
$ npm install --save require-resolve
var requireResolve = require('../'),
path = require('path');
// Resolve a absolute file
console.log(requireResolve(__filename));
// Resolve a relative file
console.log(requireResolve('./example/simple.js', path.dirname(path.dirname(__filename))));
// output:
/*
{
src: '/Users/{your_name}/Workspace/require-resolve/example/simple.js',
pkg: {
name: 'require-resolve',
version: '0.0.1',
main: 'src/require-resolve.js',
root: '/Users/{your_name}/Workspace/require-resolve'
}
}
*/
// Resolve a node module file
console.log(requireResolve('glup', __filename));
console.log(requireResolve('glup/taskTree', __filename));
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using gulp.
Copyright (c) 2015 Zhonglei Qiu. Licensed under the MIT license.
FAQs
Use the node way to resolve required path to absolute path.
The npm package require-resolve receives a total of 56,452 weekly downloads. As such, require-resolve popularity was classified as popular.
We found that require-resolve 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.