-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: Add lineNumber #8393
Comments
@ev1stensberg Can you give an example? |
I have a config file, where user can input line number and a string. (linenumber is if the line number is correct and the string is the same as in the config, we log and write to the Let me know if this was unclear! const readline = require('readline')
const fs = require("fs")
module.exports = function(){
const outi = fs.createWriteStream('output.txt')
const rl = readline.createInterface({
input: fs.createReadStream('input.txt')
})
let counter = 0;
rl.on('line', (line) => {
++counter
lineNumber.filter( (lines) => {
if(lines === counter) {
query.filter ( (pair) => {
if(pair === line) {
console.log("yess", line)
outi.write(pair)
}
})
}
})
})
} |
Compared, having |
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
LineNumber: line.number
}); This is rather a crazy idea, but having this run in parallell, so we could do something like lineNumber.filter( (number) => {
if(rl.LineNumber === number) {
console.log("yeeey")
} |
While emitting 'line' event, line number will be emitted as second parameter. ```js rl.on('line', (input, lineNumber) => { console.log(`Received: ${input}, line #: ${lineNumber}`); }); ``` Refs: nodejs#8393
As I mentioned in the PR related to this, I am -1 on this idea. It's easy enough to do in userland and IMHO adding it to core would be a sign of feature creep. |
Right now, I can't find out how to read a line number of a module, using
readLine
. I thought this was already implemented, but it is not :/ Is there anyway to get this to work / find out a line number of a module?The text was updated successfully, but these errors were encountered: