Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Root797507yNodeJS docs: this method was introduced last version; will be deprecated next version.
-
Froot75397yNooooooooo don't use sync in readdir, use the async method and wrap it in a promise that you then return and resolve with the filtered results. I try to only use sync when really really really needed.
Otherwise good post 😄 -
BroCow10197y@froot can u simplify, back in my days we used callbacks... wtf is this new promise shit
-
ctwx3617y@BroCow that way you don't need to nest your callbacks. Your code gets much cleaner. Have a look at this: https://youtu.be/2d7s3spWAzo
-
thedev11717y@BroCow basically promises prevent you from having a code that look like an inception algorithm 😂😂😂😂😂😂
-
BroCow10197y@ctwx thank you for the link Mr.Dude it cleared my doubts
@thedev promise looks promising and all, but i like callbacks better, no overhead, and i got used to it -
Froot75397y@BroCow 😄 I don't think Promises incur much overhead either. Tho callbacks still have their place. For example when your function wants to call it multiple times, like in a socket server for example
Related Rants
-
xonya26So, eventually they understood a lot of SO users are assholes. 😁
-
BambuSource21Internet streaming website be like: Oh no, you can't right click and save the video file on your computer! *...
-
brod12Holy crap, just consulted with a company who wanted to fire the entire 6 person backend team because: "They d...
Me: nodejs, how to iterate through a folder
Quora: let me tell you a story , when me and my fath.....
Stackoverflow: -1, please refer to guidelines
Yahoo answer: type command "rm -rf *"
Omegle: m 26 india ....
Cleverbot: const fs = require('fs')
const path = require('path')
function getDirectories (srcpath) {
return fs.readdirSync(srcpath)
.filter(file => fs.lstatSync(path.join(srcpath, file)).isDirectory())
}
then recurrence
me: thx cleverbot
undefined
fuck my by a black dude
wow