Skip to content

Commit

Permalink
added node.js based qr-generator
Browse files Browse the repository at this point in the history
  • Loading branch information
krishna6431 authored Oct 2, 2023
1 parent 0bac1db commit 13004ef
Show file tree
Hide file tree
Showing 3 changed files with 664 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 13004ef

Please sign in to comment.