Build a Node.js Password Generator

Поделиться
HTML-код
  • Опубликовано: 24 июл 2024
  • Build a simple command-line app using Node.js along with Commander and Chalk
    Code:
    github.com/bradtraversy/passgen
    Node.js API Course: Coupon MONTHNAME2021
    www.udemy.com/course/nodejs-a...
    💖 Support The Channel!
    / traversymedia
    Packages:
    Commander.js - github.com/tj/commander.js
    Chalk - github.com/chalk/chalk
    Clipboardy - github.com/sindresorhus/clipb...
    Timestamps:
    0:00 - Intro & Demo
    3:18 - Setup & process.argv
    6:30 - Commander Program
    7:46 - Creating Commands & Options
    14:09 - Generate Password Functionality
    21:04 - Use Chalk for Better Output
    22:03 - Copy to Clipboard
    23:16 - Save Password to a File
    28:28 - Add Symlink
  • НаукаНаука

Комментарии • 135

  • @TraversyMedia
    @TraversyMedia  3 года назад +34

    Thanks for watching guys. I just want to say, the password manager functionality is quickly whipped up to show how Commander.js works. It is just a tutorial. So I wanted to make it as simple as possible. Feel free to change createPassword and savePassword functions to suit your needs

    • @osanyinbiyusuf7308
      @osanyinbiyusuf7308 3 года назад

      Thanks Brad 😊.... anyway I love chalk.

    • @tavi7
      @tavi7 3 года назад

      These simple and quick tutorials are amazing! Keep doing them

  • @vishalarora4754
    @vishalarora4754 3 года назад +55

    Brad: The password is generated randomly
    Password - iSuck

  • @jonrhaider
    @jonrhaider 3 года назад +30

    Half of the node packages that I know about and use on almost all of my projects I know of simply from watching Brad's videos. Had never heard of Commander or Chalk, but I'm glad I know of them now, can definitely see both coming in handy at some point.

    • @TraversyMedia
      @TraversyMedia  3 года назад +15

      Yeah and that is why I love doing small projects like this. To throw some ideas your way and give you some resources

  • @janelevensalvador5699
    @janelevensalvador5699 3 года назад +11

    20:32 iSuck. What are the possibilities lol

    • @TraversyMedia
      @TraversyMedia  3 года назад +4

      I noticed that and laughed :) The universe is trying to tell me something lol

    • @shubhindu
      @shubhindu 3 года назад +1

      @@TraversyMedia I was offended on your behalf.

  • @mexicanmax227
    @mexicanmax227 3 года назад +3

    Thanks Brad! I picked coding on my off days about 3 1/2 weeks ago and went from your 20 javascript projects course, to doing rest apis with, front end multi nested scalable and fully functional modern websites. You helped me get started, and your setting a path for my sons future, thank you 🙏.

  • @SkipperChuck42
    @SkipperChuck42 3 года назад

    excellent tutorial. my first of hopefully many NodeJs projects. I love the fact that Node has such simple-to-use yet very useful modules like commander and chalk readily available ... my primary languages of late have been Java and Groovy, and trying to find a decent CLI library for such things was not so easy. Apache Commons has something like commander available, but the colorized console logging of chalk I almost always have to roll my own. Looking forward to more tutorials. Cheers

  • @HOPEDACODER
    @HOPEDACODER 3 года назад

    Mr Traversy, thank you. You've taught me so much, more than I thought I could ever learn.

  • @maxivy
    @maxivy 3 года назад

    One of your best simple ones yet. Thank you Brad.

  • @andersstromberg6745
    @andersstromberg6745 3 года назад

    Very good Brad! Thanks for this instructive video. I instantly came up with a bunch of projects I want to try out on my own. You are doing great, as always.

  • @yodkwtf
    @yodkwtf 3 года назад

    Will we see a styled-components crash course from you, Brad? Love what you do for all of us! Thanks

  • @unknownmonkey8661
    @unknownmonkey8661 3 года назад

    Never seen videos on this topic. Bless you Brad

  • @alfonsogutierrez2749
    @alfonsogutierrez2749 2 года назад +3

    If anyone encounters errors, such as ESM errors, after installing chalk and clipboardy, you need to uninstall them. Then install older versions. This is how:
    npm install chalk@4.1.2
    npm install clipboardy@2.3.0
    Also, some might get a permissions error when saving to a text file and can't open it. Change the permission to 0666.

  • @gbrachetta
    @gbrachetta 3 года назад +4

    May be good pointing out that you don't need the equal sign for the length, in fact the short command (-l) won't work with it. I believe it should be used as '---length 20' or '-l 20'

  • @brilliantatosam6882
    @brilliantatosam6882 3 года назад +1

    Hey Brad?! It's good to hear from you once again. Can you please make a video on how you make your videos. like the software you use from recording to editing and conversion.
    Thank in advance!

  • @sahul._
    @sahul._ 3 года назад +6

    Great Brad doing a great job.

  • @Rusian-mv8gu
    @Rusian-mv8gu 2 года назад

    I love how the first password literally says "iSuck". Nice video!

  • @rafapioli75
    @rafapioli75 3 года назад

    Great explanation! Thanks for your time! I always learn something with your videos!

  • @initiala2375
    @initiala2375 2 года назад

    need more videos like this brad, only focus on nodejs ❤

  • @Taffman91
    @Taffman91 3 года назад +7

    First password it generated was iSuck1cX (I read that funny)

  • @contenidonerd
    @contenidonerd 3 года назад

    Thanks Brad, you really make see programming easy

  • @devtam
    @devtam 3 года назад

    I made my own version and added a couple extra features like clearing passwords.txt and creating passwords in batches. My github is devtamer and it's live there

  • @igorbb
    @igorbb 3 года назад

    Thanks, Brad. This is a useful tutorial. Is it possible to create the same tutorial using only Node.js functionality?

  • @JohnDoe-sz5jh
    @JohnDoe-sz5jh 3 года назад

    Thanks Brad, this is just what I needed.

  • @amans6504
    @amans6504 3 года назад +1

    8:30 idk if i've done anything wrong but it was logging "generated" even when i didnt provide the args in the cmd

  • @venkatesh2788
    @venkatesh2788 3 года назад +1

    Sir how to get user input in nodejs from command line, in a single line of code

  • @rickyrozario1577
    @rickyrozario1577 3 года назад

    Great video as always Brad. I can't seem to make the Symlink work on Windows. Any suggestions?

  • @khaled5898
    @khaled5898 3 года назад

    Hey! I've got a question. How do we save the password.txt to the users desktop instead of saving it inside util?

  • @SENPAI-mi6sz
    @SENPAI-mi6sz 3 года назад +9

    I needed this thank you

    • @morshedulislamriaad6496
      @morshedulislamriaad6496 3 года назад +5

      Why you needed this bro?

    • @kornelgeczi4589
      @kornelgeczi4589 3 года назад +1

      @@morshedulislamriaad6496 For anything that he wants.

    • @yuck59
      @yuck59 3 года назад +1

      @@kornelgeczi4589 i think he's just trying to understand the use case for this. no need for the snarky comment 🙂

    • @kornelgeczi4589
      @kornelgeczi4589 3 года назад +1

      @@yuck59 Yep, you say true. :)

  • @ariolverab
    @ariolverab 3 года назад

    Thanks Brad! what is your VSCode theme ?

  • @marcosochieng5175
    @marcosochieng5175 3 года назад

    Thanks Brad forever grateful. Love frm Kenya

    • @darkwolf-ol7pm
      @darkwolf-ol7pm 3 года назад

      hata wewe uko huko...awesome instructor

  • @yajurrai6491
    @yajurrai6491 3 года назад +1

    just waiting for a node.js project ;)

  • @Mo_sch2001
    @Mo_sch2001 3 года назад +3

    Can you please make more backend stuff, like REST API and authentication ... etc

    • @TraversyMedia
      @TraversyMedia  3 года назад +8

      The backend stuff usually takes longer, so I tend to do most of that content in my courses. I like to keep youtube videos under an hour. I will see what I can do though. I just did a Fastify crash course :)

  • @subhashparwani5843
    @subhashparwani5843 3 года назад

    Sir, can you make the video on React js navbar click function? After clicking the navbar item, it should go to that section on the same page. NOT THE ROUTING from one page to another. PLEASE, SIR.

  • @_modiX
    @_modiX 3 года назад +3

    I would never select Node.js for that task. I think for cross-platform tools Python is way better suited, because you don't need a bunch of dependencies to get stuff going, plus, Node.js is often installed with different versions on developer machines. I think Deno will change that, since you can compile to a single binary with it.
    I still appreciate your tutorial, just my two cents. I think your tutorial will be useful to those who will build global CLI tools for node environments.

    • @TraversyMedia
      @TraversyMedia  3 года назад +2

      Thanks for the feedback. In no way am I saying you should or shouldn't use Node. It is just a tutorial. Maybe I will do the same thing in Python.I need some ideas for Python tutorials anyway :)

    • @williamperry2074
      @williamperry2074 3 года назад

      @@TraversyMedia How about one showcasing Python, FastAPI, and Tortoise ORM

    • @0x007A
      @0x007A 3 года назад

      Package the Node.js application in a container for distribution and deployment. Create an alias or symlink to the container so it behaves like a native application.

  • @manvendrasingh7838
    @manvendrasingh7838 3 года назад

    I have a question: When algoexpert will change its ad?

  • @pietrovr46
    @pietrovr46 2 года назад

    Which VSCode extensions are you using ?

  • @nirmesh44
    @nirmesh44 3 года назад

    Very useful. mind blowing!

  • @shivraj1459
    @shivraj1459 3 года назад

    More projects on node js please

  • @avi12
    @avi12 3 года назад +5

    19:35 Why not use: chars[randomI]?

    • @maxd7228
      @maxd7228 3 года назад

      Agreed, a batter solution.

    • @hoangtruong2239
      @hoangtruong2239 3 года назад

      could you specify the code for it?

  • @adityabansal4033
    @adityabansal4033 3 года назад

    fs.open can be replaced with fs.appendFile ?

  • @alaribebright9021
    @alaribebright9021 3 года назад +1

    Thanks Brad. How do you keep the energy going?

    • @TraversyMedia
      @TraversyMedia  3 года назад +10

      I don't know friend lol. I actually have slowed down quite a bit after years of overworking myself. Normally I would have 4 courses out this year already. I have done 1. I needed to slow down for my mental health though :)

    • @shloimiminkowicz4188
      @shloimiminkowicz4188 3 года назад

      @@TraversyMedia You do what you you need to do Brad, will support you as allways no matter what!! Speaking of witch, would you consider creating a you tube or a udemy course for building a nice responsive Next.js portfolio website with like Strapi on the backend ?

    • @alaribebright9021
      @alaribebright9021 3 года назад

      @@TraversyMedia Thanks for the reply. Your impact is massive. Health wise, family wise, the quality of content hasn't dropped. Hopefully I can one day, help others as you do. Cheers

  • @gopinathkrm58
    @gopinathkrm58 3 года назад +2

    Great as always, theme looks cool by the way, name please?

  • @mayman8415
    @mayman8415 3 года назад +1

    Hey Brad pls pls create a css and javascript tutorial from the very basics. I am burned out and now I want to come back but I can't fine nice tutorials

  • @sayakduttaa
    @sayakduttaa 3 года назад

    Hey brad, could you just tell what is the name of your current VS Code theme ?

  • @g7k993
    @g7k993 3 года назад

    Hey Brad, I regret buying your courses on Packtpub (not subscription but I bought them) the reason is because Udemy users get an update and we don't :(
    most of your courses there are behind udemey updates.

  • @dhaval0
    @dhaval0 3 года назад +1

    I am new to node js I am confused in this too many modules. anyone can tell me what is most useful/user modules to learn first??(I know basics about express and tamplet engine mongooses etc)

    • @TraversyMedia
      @TraversyMedia  3 года назад

      Express is your main web framework for handling http req/res. Great for building backend apis. There are packages for everything. You just learn and use what you need. The ones in this video are not “need to know”, but can be useful if you need to create some kind of command line interface

    • @dhaval0
      @dhaval0 3 года назад

      @@TraversyMedia thank you I am exploring new modules for different task like bcryptjs, jwt , express-sessions etc

  • @renu3463
    @renu3463 3 года назад

    Node.js Typescript tutorial plzzz ❤️

  • @williams855
    @williams855 3 года назад

    thanks but I've got a problem with chmod 666, it's not working as yours. can't access the output file. so I did a little bit research and I found 0o666 that just worked as how I expected. what's the difference between them?

    • @SkipperChuck42
      @SkipperChuck42 3 года назад

      was just going to point this out ... the value must be octal, so it needs the "0o" on the front. As a side note, if this was an actual password generator that you would use for real, you would not want "0o666", you would want either "0o640" or, better yet, "0o600" for security reasons. You probably don't want your passwords file to be world read-/writable. :)

    • @williams855
      @williams855 3 года назад

      ​@@SkipperChuck42 thanks but in the video, he could've read the file with only giving 666 as parameter, how? 27:43

    • @ibrudiiv
      @ibrudiiv 3 года назад

      @@williams855 certain/different permissions on os x

  • @wahidurrahman8993
    @wahidurrahman8993 3 года назад

    When you updated your UDEDMY JavaScript tutorial course ??

    • @TraversyMedia
      @TraversyMedia  3 года назад +5

      I have not yet. I need to update the React one first because there are some outdated packages and APIs. The JS one is still vert relevant

    • @parvati27
      @parvati27 3 года назад

      @@TraversyMedia React course was greatt , thankss brad , you're the best

    • @wahidurrahman8993
      @wahidurrahman8993 3 года назад

      @@TraversyMedia I believe once you updated JS course like Tracalorie Project refactor code like import-export which is helpful then after 5/6 years don't need to think about JS course but react needed every 6 months or 8 months

  • @OstonCodeCypher
    @OstonCodeCypher 3 года назад +1

    Some WordPress Theme Development Crash Course

  • @jaleotech5918
    @jaleotech5918 3 года назад

    Brad.. what about being able to create a pw file with multiple pw in the file like say 20 pw?

    • @TraversyMedia
      @TraversyMedia  3 года назад

      The passwords.txt file does hold multiple passwords. I may not be understanding correctly, however anything is possible.

    • @jaleotech5918
      @jaleotech5918 3 года назад

      @@TraversyMedia thanks for the reply .. I sort of sucked at describing it.
      So run the command with a parameter than generates a password.txt file that ends up with say 20 passwords in it.
      Instead of having to run it several times to keep adding a pw at a time

    • @jaleotech5918
      @jaleotech5918 3 года назад

      @@TraversyMedia also call me crazy but I end up only watching the vids YOU do cuz of they way you explains stuff vs when you have others on your channel.. first thing I listen for is your voice. I guess that shite is hard to change.. I love your vids!!

    • @0x007A
      @0x007A 3 года назад +1

      @@jaleotech5918, you should be able to add this feature using the examples in the video. Add an option that takes an argument (defaults to 1), implement a function containing a loop and within the loop call the generatePassword() and savePassword() functions. Good luck!

    • @jaleotech5918
      @jaleotech5918 3 года назад

      ​@@0x007A nice touch.. As Brad said "anything is possible" it's an awesome channel

  • @christiang2066
    @christiang2066 3 года назад

    For some reason, it creates a file I have no permission to read or write

  • @josesamuelproducoes2843
    @josesamuelproducoes2843 3 года назад

    Beautiful

  • @slowedReverbJunction
    @slowedReverbJunction 3 года назад

    passgen is not working
    I have a Windows machine

  • @rishabsharma5307
    @rishabsharma5307 3 года назад

    🔥🔥🔥

  • @Rafhy258
    @Rafhy258 3 года назад

    Wana seriously learn node js.

  • @mkgamingentertainment3786
    @mkgamingentertainment3786 3 года назад

    This is amazing

  • @tuhidulislammridul3126
    @tuhidulislammridul3126 3 года назад

    jus wow

  • @moviesclips6708
    @moviesclips6708 3 года назад

    Please make ember js tutorial

    • @TraversyMedia
      @TraversyMedia  3 года назад +1

      It's been a while. It's definitley possible though. Ember Crash Course :)

    • @moviesclips6708
      @moviesclips6708 3 года назад

      @@TraversyMedia Tq Brad 🙂

  • @n_fan329
    @n_fan329 3 года назад

    ❤️

  • @techtravelspirituality3573
    @techtravelspirituality3573 3 года назад

    Thanks...

  • @AsteriosPatsikas
    @AsteriosPatsikas 3 года назад

    If you use Linux you might need to run sudo

  • @codewithpython4961
    @codewithpython4961 3 года назад

    very nice

  • @soniablanche5672
    @soniablanche5672 3 года назад +1

    lmao the first password generated, it was literally 1 letter away from being an actual sentence

  • @kmohan2541
    @kmohan2541 3 года назад

    😀

  • @e-benz
    @e-benz 3 года назад +1

    i would rather use semicolons

  • @ubaidsid9472
    @ubaidsid9472 3 года назад +3

    20:32 password generated is: iSuck

  • @jeromesnail
    @jeromesnail 3 года назад

    They really should "promisify" those async built in function, all those callbacks give me vertigo.

    • @TraversyMedia
      @TraversyMedia  3 года назад +1

      lol, I know. A bit of callback hell. Honestly the main point is to show commander, chalk, etc. The other stuff is just to make it do something.I didn't want to make it complicated and explain promises, etc. People can create and use whatever they want from it

    • @jeromesnail
      @jeromesnail 3 года назад

      @@TraversyMedia "We have to go deeper"

    • @soniablanche5672
      @soniablanche5672 3 года назад

      A lot of nodejs built-in actually have a promise version. For fs for example you can access the promise version of writeFile with fs.promises.writeFile. Also writeFile is a shortcut for open => write => close.

  • @Amanali-rl9hw
    @Amanali-rl9hw 3 года назад +1

    Noice🌚

  • @ariii107
    @ariii107 3 года назад

    First 😍

  • @omarqureshi8070
    @omarqureshi8070 3 года назад

    # Heaath Ledger-Joker Voice, Love your vids Man helped me out a lot

  • @kaustav195
    @kaustav195 3 года назад

    That's just too many ads

  • @fiendsgaming7589
    @fiendsgaming7589 3 года назад

    i just use regex

  • @richardkirigaya8254
    @richardkirigaya8254 3 года назад

    ummm.....666 ? 😲😲

  • @Foused87
    @Foused87 3 года назад

    30 minutes? I can code 80% of this app in pure js

  • @mikoo1991
    @mikoo1991 3 года назад

    please stop making videos for beginners. a lot of your viewers have evolved and making more advanced content should be the natural step forward. im seriously considering unsubscribing because there is just too little value I get from your videos anymore. for example, make COMPLEX projects, maybe a project series, instead of beginner tutorials.

  • @webdecodedwithfahad4414
    @webdecodedwithfahad4414 3 года назад

    ♥️