0.0.7 • Published 1 year ago

base64-qrcode v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

base64-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 base64-qrcode

Example

import { drawQRCode } from 'base64-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。
0.0.7

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.6

1 year ago

0.0.1

1 year ago