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 Наука
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
Thanks Brad 😊.... anyway I love chalk.
These simple and quick tutorials are amazing! Keep doing them
Brad: The password is generated randomly
Password - iSuck
Lmao
glad someone else caught this
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.
Yeah and that is why I love doing small projects like this. To throw some ideas your way and give you some resources
20:32 iSuck. What are the possibilities lol
I noticed that and laughed :) The universe is trying to tell me something lol
@@TraversyMedia I was offended on your behalf.
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 🙏.
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
Mr Traversy, thank you. You've taught me so much, more than I thought I could ever learn.
One of your best simple ones yet. Thank you Brad.
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.
Will we see a styled-components crash course from you, Brad? Love what you do for all of us! Thanks
Never seen videos on this topic. Bless you Brad
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.
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'
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!
Great Brad doing a great job.
I love how the first password literally says "iSuck". Nice video!
Great explanation! Thanks for your time! I always learn something with your videos!
need more videos like this brad, only focus on nodejs ❤
First password it generated was iSuck1cX (I read that funny)
Thanks Brad, you really make see programming easy
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
Thanks, Brad. This is a useful tutorial. Is it possible to create the same tutorial using only Node.js functionality?
Thanks Brad, this is just what I needed.
8:30 idk if i've done anything wrong but it was logging "generated" even when i didnt provide the args in the cmd
Sir how to get user input in nodejs from command line, in a single line of code
Great video as always Brad. I can't seem to make the Symlink work on Windows. Any suggestions?
Hey! I've got a question. How do we save the password.txt to the users desktop instead of saving it inside util?
I needed this thank you
Why you needed this bro?
@@morshedulislamriaad6496 For anything that he wants.
@@kornelgeczi4589 i think he's just trying to understand the use case for this. no need for the snarky comment 🙂
@@yuck59 Yep, you say true. :)
Thanks Brad! what is your VSCode theme ?
Thanks Brad forever grateful. Love frm Kenya
hata wewe uko huko...awesome instructor
just waiting for a node.js project ;)
Can you please make more backend stuff, like REST API and authentication ... etc
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 :)
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.
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.
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 :)
@@TraversyMedia How about one showcasing Python, FastAPI, and Tortoise ORM
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.
I have a question: When algoexpert will change its ad?
Which VSCode extensions are you using ?
Very useful. mind blowing!
More projects on node js please
19:35 Why not use: chars[randomI]?
Agreed, a batter solution.
could you specify the code for it?
fs.open can be replaced with fs.appendFile ?
Thanks Brad. How do you keep the energy going?
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 :)
@@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 ?
@@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
Great as always, theme looks cool by the way, name please?
The VSCode theme is Github Dark
@@TraversyMedia thanks
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
Hey brad, could you just tell what is the name of your current VS Code theme ?
Github Dark
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.
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)
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
@@TraversyMedia thank you I am exploring new modules for different task like bcryptjs, jwt , express-sessions etc
Node.js Typescript tutorial plzzz ❤️
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?
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. :)
@@SkipperChuck42 thanks but in the video, he could've read the file with only giving 666 as parameter, how? 27:43
@@williams855 certain/different permissions on os x
When you updated your UDEDMY JavaScript tutorial course ??
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
@@TraversyMedia React course was greatt , thankss brad , you're the best
@@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
Some WordPress Theme Development Crash Course
Brad.. what about being able to create a pw file with multiple pw in the file like say 20 pw?
The passwords.txt file does hold multiple passwords. I may not be understanding correctly, however anything is possible.
@@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
@@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!!
@@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!
@@0x007A nice touch.. As Brad said "anything is possible" it's an awesome channel
For some reason, it creates a file I have no permission to read or write
Beautiful
passgen is not working
I have a Windows machine
🔥🔥🔥
Wana seriously learn node js.
This is amazing
jus wow
Please make ember js tutorial
It's been a while. It's definitley possible though. Ember Crash Course :)
@@TraversyMedia Tq Brad 🙂
❤️
Thanks...
If you use Linux you might need to run sudo
very nice
lmao the first password generated, it was literally 1 letter away from being an actual sentence
Strange isn't
😀
i would rather use semicolons
20:32 password generated is: iSuck
1cX... add a D LOL
They really should "promisify" those async built in function, all those callbacks give me vertigo.
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
@@TraversyMedia "We have to go deeper"
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.
Noice🌚
First 😍
# Heaath Ledger-Joker Voice, Love your vids Man helped me out a lot
That's just too many ads
i just use regex
ummm.....666 ? 😲😲
I thought I was the only one that saw it... 419 is better than 666
30 minutes? I can code 80% of this app in pure js
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.
♥️