npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xwa

v0.0.0-alpha.1

Published

Reliable WebSocket transport.

Downloads

1

Readme

draw-qrcode

Generate Base64 QR code based on QRCode algorithm.
生成基于QRCode算法的Base64二维码。

  • Create Base64-based QR Code. Applicable to Vue, Vue3, React, Angular, Svelte, native JavaScript, TypeScript and NodeJS server environments.
  • 创建基于Base64的QR Code。适用于Vue、Vue3、React、Angular、Svelte、原生JavaScript、Typescript和NodeJS服务端环境。

Use

Use npm/yarn/pnpm

pnpm add draw-qrcode

Example

import { drawQRCode } from 'draw-qrcode'
    
// Output base64 encoded imgData
const base64String = drawQRCode('Hello QRCode!', {
  typeNumber: 4,
  errorCorrectLevel: 'M',
  size: 200
})
console.log(base64String)

API

en-US

  • drawQRCode: Draw Base64 QR code.
  • typeNumberQR code type,the default value is 4, and the optional values are 1~40. 1 is 2121, 2 is 2525, 3 is 3333, 4 is 4141, and 40 is a 177*177 matrix.
  • errorCorrectLevelQR code error tolerance rate, the default value is 'M', and the optional values are 'L', 'M', 'Q', and 'H'. L: 7%, M: 15%, Q: 25%, H: 30% error tolerance (errors can be corrected). The higher the error tolerance, the less likely the QR code is to be damaged, but the less likely it is to be recognized.
  • sizeQR code image size, the default value is 300.
  • backgroundColorQR code background color, the default value is '#ffffff'.
  • foregroundColorQR code foreground color, the default value is '#000000'.
  • codePaddingQR code padding, the default value is 10.

zh-CN

  • drawQRCode: 绘制Base64二维码的方法。
  • typeNumber二维码类型,默认值为4,可选值为1~40。1为2121,2为2525,3为3333,4为4141,40为177*177的矩阵。
  • errorCorrectLevel二维码容错率,默认值为'M',可选值为'L'、'M'、'Q'、'H'。 L: 7%, M: 15%, Q: 25%, H: 30% 容错率(错误能被纠正)。容错率越高,二维码越不易损坏,但越不易识别。
  • size二维码图片大小,默认值为300。
  • backgroundColor二维码背景色,默认值为'#ffffff'。
  • foregroundColor二维码前景色,默认值为'#000000'。
  • codePadding二维码边距,默认值为10。