Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
position-in-file-async
Advanced tools
A node.js util to find asynchronously element position on a file list
A node.js util to find asynchronously element position on a file of a folder.
position-in-file-async
is the async version of position-in-file.
Install position-in-file-async
via npm :
npm install --save position-in-file-async
Use it :
const positionInFileAsync = require('position-in-file-async')
//positionInFileAsync(needle, haystack, options)
//Exemple :
positionInFileAsync('element-to-look-for', 'where-to-search', {deep: false, ...}).then(result => console.log(result))
//Result :
[
{file: 'finded-in-this-file.ext', lines: {2: [5]}}, //Line 2 column 5
{file: 'finded-here.too.ext', lines: {1: [2, 19]}}, //Line 1 column 5, line 1 column 19
...
]
If node doest display deep object you can use util.inspect :
const inspect = require('util').inspect
positionInFileAsync('element-to-look-for', 'where-to-search').then(result => console.log(inspect(result, {showHidden: false, depth: null})))
needle
(String || RegExp) : The element to search, can be a string or a regular expression.haystack
(String) : The path where the research will be executed, it can be a file or folder path. If haystack is not defined the research will be excecuted in the current folder.options
(Object) : Some aditionnals options :
deep
(Boolean) : If the research will be apply on deep folder. Default : true
.ignore
: (Array) An array to define the file/filter to ignore. Default : empty array.fullPathRequired
(Boolean) : If full path need to be specified on option.ignore
or just the file name. Default : true
.gitIgnore
(Boolean) : If .gitIgnore's file/folder need to be ignored. Default : true
.MIT
FAQs
A node.js util to find asynchronously element position on a file list
The npm package position-in-file-async receives a total of 0 weekly downloads. As such, position-in-file-async popularity was classified as not popular.
We found that position-in-file-async 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.