Skip to content

denorg/qrcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

51 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‡ QR Code

Generate QR codes in Deno, as base64-encoded images, completely dependency-free and requires no binary.

This is a port of zenozeng/node-yaqrcode, which itself is a port of the QR code generator in the d-project.

Deno CI GitHub Contributors Deno Starter Made by Denorg TypeScript semantic-release

⭐ Getting started

import { qrcode } from "https://deno.land/x/qrcode/mod.ts";
const base64Image = await qrcode("bitcoin:ADDRESS?amount=0.5&label=ORDER"); // data:image/gif;base64,...

QR code

You can also add a custom size by specifying size in the second parameter:

const fixedSizeImage = await qrcode("bitcoin:ADDRESS?amount=0.5&label=ORDER", { size: 500 });

Deno.serve example

The examples/server.ts file exposes QR codes over HTTP using Deno.serve:

deno run --allow-net examples/server.ts

Then open a URL like this to receive a GIF response:

http://localhost:4000/?data=Hello%20World!&size=250&typeNumber=5&errorCorrection=L

Short query parameters are also supported for compact URLs: d, s, v, and e.

CLI with DPX

After installing DPX, you can directly use the CLI using the dpx command:

dpx qrcode <text>

CLI

Alternatively, you can use it directly from the CLI by using deno run:

deno run https://deno.land/x/qrcode/cli.ts <text>

You can also install it globally using the following:

deno install https://deno.land/x/qrcode/cli.ts

Then, the package is available to run:

qrcode <text>

πŸ‘©β€πŸ’» Development

Run tests:

deno test

Notes

⭐ Related Work

πŸ“„ License

A project by Denorg, the world's first Deno-focused community
organization and consulting company. Work with us β†’

About

πŸ“‡ Generate QR code images in Deno

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

45 stars

Watchers

6 watching

Forks

Packages

 
 
 

Contributors