Skip to content

Commit

Permalink
Merge pull request #338 from krishna6431/main
Browse files Browse the repository at this point in the history
added node based qr-code generator
  • Loading branch information
Ananyasingh2002 authored Oct 2, 2023
2 parents 99821fc + 13004ef commit 02f177e
Show file tree
Hide file tree
Showing 4 changed files with 690 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Project/QR-Code-Generator/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
1. Use the inquirer npm package to get user input.
2. Use the qr-image npm package to turn the user entered URL into a QR code image.
3. Create a txt file to save the user input using the native fs node module.
*/

import inquirer from "inquirer";
import qr from "qr-image";
import fs from "fs";

inquirer.prompt([
{
message: "Type Your URL: ",
name: "URL",
}
]).then((answers) => {
console.log(answers);
const url = answers.URL;
var qr_svg = qr.image(url);
qr_svg.pipe(fs.createWriteStream("qr_image.png"));
}).catch((err) => {
if (err.isTtyError) {

}
else {

}
})
Loading

0 comments on commit 02f177e

Please sign in to comment.