3

How do you get a list of the names of all files present in a directory in Node.js?

getting all filenames in a directory with node.js [closed]

I can't find where in the documentation I can get all filenames in a directory.

The question linked and quoted above is a straightforward question about how one accomplishes a certain task in Node.js. It's poorly framed and worded, but, with a quick edit, it could be made a pretty standard question for the site.

Instead, it has been closed as off topic and locked with an explanation that seems based on a fundamental misreading of the question.

The explanation given for the close is that it is "off-topic because it is asking for recommendations".

It isn't asking for recommendations. It's simply asking how one can get all the filenames in a directory in Node.js. The reference to documentation isn't asking for a recommendation; it's stating that the user hasn't been able to turn up an answer elsewhere. All of that is pretty standard for Stack Overflow and has been since the beginning.

Rather than closing and locking the question, it could easily be edited along these lines:

How do you get a list of all the filenames in a directory in Node.js?

How do you retrieve a list of all filenames that exist in a particular directory in Node.js?

That would make it easily on-topic and directly in line with a majority of the questions asked on Stack Overflow.

So what gives? Why was it closed (six years later)? And why lock it, preventing other users from correcting the erroneous close?

To clarify: I don't think this is a recommendation question because it has a single, discrete, clear answer.

This question could be formatted as:

Q: "How do I get a list of filenames in a directory in Node.js?"

A: With fs.readdir() .. // further details

There are other options and possibilities, which many users have supplied and which are helpful. But the original asker wasn't asking for a list, they were simply asking for the answer.

23
  • 11
    It's an awful help-vampire question? People were using it as a justification to vomit their help-vampire questions on SO? It was attracting nonsense answers/comments/flags/spam? It's hump day?
    – user1228
    Feb 1, 2017 at 21:19
  • I would agree with the locking it's a poor quality question, however the 'off topic' is just wrong the topic is valid for Stack over flow and @Will help-vampire is that not what Stack overflow is for to provide a range of answers to a question that could be commonly needed. so if you think people should not be asking for help on SO what should they be using it for?
    – user623150
    Feb 1, 2017 at 21:24
  • The goal of stackoverflow is to categorize information and make it easily searchable. That was the first result in google for my search and provided a wealth of information that I could easily digest in a matter of minutes. It would otherwise have taken me 15 - 20 minutes of googling and wading through documentation to assess the the various alternatives that were laid out in that question. It easily saved me 15 minutes by providing well summarized and digestible information. I'm sure it's done the same for many others. I don't think it matters that the original asker was a little lazy. Feb 1, 2017 at 21:25
  • Possible duplicate of Let's rescue wayward resource requests! (trial run)
    – gnat
    Feb 1, 2017 at 21:28
  • @gnat Are you saying with that duplicate that the information in that question is outdated? Because that would make sense, but that's different than what that question was closed for. And in the case that the information is out of date, would it not better to find some ways to invalidate the out of date answers and to provide updated ones than to simply close it with an unmatched closed message that says nothing about the actual information in the question? Feb 1, 2017 at 21:33
  • 4
    I am saying that this looks like a solid candidate for rescuing as described in duplicate. Unlock (and protect because otherwise its 300K views will attract garbage), edit into shape, remove garbage answers, profit
    – gnat
    Feb 1, 2017 at 21:38
  • @will I fundamentally disagree with the idea that there is such a thing as a help vampire on site like Stackoverflow. Obvious homework questions aside, if a question has no duplicate, then who cares if the asker was lazy? The result produced in Stackoverflow answers has value far above and beyond any negative produced by a lazy question asker. Stackoverflow questions often collect, summarize, categorize, and rate information that would otherwise have to be parsed out of numerous sources. And that information helps many other people beyond the original asker. Feb 1, 2017 at 21:42
  • @Gnat Ah, I see. That course makes sense to me! Feb 1, 2017 at 21:47
  • @gnat Although, it's not immediately obvious how this question can be added to that one as a candidate... is there an established process there? Feb 1, 2017 at 21:48
  • 1
    It wasn't closed for "asking for recommendations"; it was closed for "asking for an off-site resource" due to the "I can't find where in the documentation..." statement in the question. Also, it's not deleted, it's just closed, so the information is still available for people to visit and learn from. Also, I wouldn't say that it being like a lot of questions is necessarily a good thing, considering the quality of questions I see showing up in the javascript tag.... Feb 1, 2017 at 21:51
  • 1
    You may be right, but the question is very badly worded. It took me three readings to work out that it probably isn't a resource request. If you're prepared to edit the question I'll unlock it so you can, and then look at reopening once you have.
    – ChrisF Mod
    Feb 1, 2017 at 22:01
  • 1
    @gnat Thanks for the link, that was really helpful! I edited the question to show why I don't think it is a recommendation question. Feb 1, 2017 at 22:04
  • 1
    @duplode Sorry, I often err on the side of brevity over intelligibility. Feb 1, 2017 at 22:39
  • 3
    @MikeMcCaughan It happens -- I have to pay close attention to avoid running into the opposite problem :)
    – duplode
    Feb 1, 2017 at 22:43
  • 1
    I fundamentally disagree with the idea that there is such a thing as a help vampire on site like Stackoverflow well, that's nonsense. If you want SO to be a place where people vomit their requirements and expect other people to do their work, you'll just drive away the experts who are willing to help. That subject is well covered both here and on m.se. I'll give you one thing, though. I did a quick search on the subject of the question, and man, the nodejs docs suck. I do agree the question in question is worthwhile because of this.
    – user1228
    Feb 2, 2017 at 15:10

1 Answer 1

5

OK. This looks like it's a misunderstanding due to a very badly worded question.

If you agree to edit (which you have), I'll unlock the question (which I have). Then once it's been edited it can be reopened.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .