https://github.com/ushelp/easyqrcodejs-nodejs
EasyQRCodeJS-NodeJS is a NodeJS server side javascript QRCode image(PNG/JPEG/SVG/Base64 data url) generator. Support setting Dot style, Logo, Background image, Colorful, Title and more. Support binary(hex) data mode.
https://github.com/ushelp/easyqrcodejs-nodejs
easyqrcodejs easyqrcodejs-nodejs javascript-qrcode js-qrcode node-qrcode nodejs nodejs-qrcode qrcode qrcode-generator qrcode-node qrcode-svg qrcodejs
Last synced: 11 days ago
JSON representation
EasyQRCodeJS-NodeJS is a NodeJS server side javascript QRCode image(PNG/JPEG/SVG/Base64 data url) generator. Support setting Dot style, Logo, Background image, Colorful, Title and more. Support binary(hex) data mode.
- Host: GitHub
- URL: https://github.com/ushelp/easyqrcodejs-nodejs
- Owner: ushelp
- License: mit
- Created: 2019-09-06T09:54:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-24T11:02:47.000Z (30 days ago)
- Last Synced: 2025-04-05T17:05:37.943Z (18 days ago)
- Topics: easyqrcodejs, easyqrcodejs-nodejs, javascript-qrcode, js-qrcode, node-qrcode, nodejs, nodejs-qrcode, qrcode, qrcode-generator, qrcode-node, qrcode-svg, qrcodejs
- Language: JavaScript
- Homepage: https://easyproject.cn/easyqrcode
- Size: 5.31 MB
- Stars: 104
- Watchers: 7
- Forks: 53
- Open Issues: 8
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# EasyQRCodeJS-NodeJS
EasyQRCodeJS-NodeJS is a NodeJS server side javascript QRCode image(PNG/JPEG/SVG/Base64 data url) generator. Support setting Dot style, Logo, Background image, Colorful, Title and more. Support binary(hex) data mode.
EasyQRCodeJS-NodeJS 是一个 NodeJS 环境下的服务端 JavaScript QRCode 图片(PNG/JPEG/SVG/Base64 data url)生成模块。支持点状风格,Logo,背景图片,规则色彩控制,标题等设置。支持二进制数据模式。
## Table of contents
- [Table of contents](#table-of-contents)
- [Choose what you need](#choose-what-you-need)
- [Feature](#feature)
- [Try It!](#try-it)
- [Demo preview](#demo-preview)
- [QR Code Structure](#qr-code-structure)
- [Installation](#installation)
- [Basic Usages](#basic-usages)
- [QRCode API](#qrcode-api)
- [Object](#object)
- [Options](#options)
- [Methods](#methods)
- [TypeScript Support](#typescript-support)
- [License](#license)
- [EasyQRCodeJS-NodeJS-Premium](#easyqrcodejs-nodejs-premium)
- [End](#end)## Choose what you need
| Project | Support |
| --- | --- |
| [EasyQRCodeJS](https://github.com/ushelp/EasyQRCodeJS) | **Running with DOM on CLIENT-SIDE .** Browser(IE6+, Chrome, Firefox, Safari, Opera, Mobile Safari, Android, Windows Mobile, ETC.), Electron, NW.js, ETC. |
| [EasyQRCodeJS-NodeJS](https://github.com/ushelp/EasyQRCodeJS-NodeJS) | **Running without DOM on SERVER-SIDE**. Save image to file(PNG/JPEG/SVG) or get data url text. NodeJS, Electron, NW.js, ETC.|
| [EasyQRCode-React-Native](https://github.com/ushelp/EasyQRCode-React-Native) | **A QRCode generator for React Native**. Generate QRCode image or get base64 data url text. |## Feature
- **English**
- Save QRCode image file without DOM on server side
- Support unicode character set: `😊❤️👍👨💻 Hello, こんにちは, こんにちは, Γεια, Привет, नमस्ते, สวัสดี, Привіт, سلام, Здравей, ສະບາຍດີ, Përshëndetje, Բարեւ, 你好`
- Support save PNG/JPEG/SVG image file
- Support get standard base64 image data url text: `data:image/png;base64, ...`
- Support get SVG data text: ``QRCode.CorrectLevel.Q`
`QRCode.CorrectLevel.M`
`QRCode.CorrectLevel.L`|
| Dot style| --- | ---|---|---|
| **dotScale** | N | Number | `1.0` |Dot style scale. Ranges: `0-1.0` |
| **dotScaleTiming** | N | Number | `1.0` |Dot style scale for timing. Ranges: `0-1.0` |
| **dotScaleTiming_V** | N | Number | `undefined` |Dot style scale for horizontal timing. Ranges: `0-1.0` |
| **dotScaleTiming_H** | N | Number | `undefined` |Dot style scale for vertical timing. Ranges: `0-1.0` |
| **dotScaleA** | N | Number | `1.0` |Dot style scale for alignment. Ranges: `0-1.0` |
| **dotScaleAO** | N | Number | `undefined` |Dot style scale for alignment outer. Ranges: `0-1.0` |
| **dotScaleAI** | N | Number | `undefined` |Dot style scale for alignment inner. Ranges: `0-1.0` |
| Quiet Zone| --- | ---|---|---|
| **quietZone** | N | Number | `0` | Quiet Zone size |
| **quietZoneColor** | N | String | `rgba(0,0,0,0)` | Background CSS color to Quiet Zone |
| Logo options| --- | ---|---|---|
| **logo** | N | String | `undefined` | Logo Image Path or Base64 encoded image. If use relative address, relative to `easy.qrcode.min.js` |
| **logoWidth** | N | Number | `width/3.5` | Fixed logo width. |
| **logoHeight** | N | Number | `height/3.5` | fixed logo height. |
| **logoMaxWidth** | N | Number | `undefined` | Maximum logo width. if set will ignore `logoWidth` value. |
| **logoMaxHeight** | N | Number | `undefined` | Maximum logo height. if set will ignore `logoHeight` value. |
| **logoBackgroundTransparent** | N | Boolean | `false` | Whether the background transparent image(`PNG`) shows transparency. When `true`, `logoBackgroundColor` is invalid |
| **logoBackgroundColor** | N | String | `#ffffff` | Set Background CSS Color when image background transparent. Valid when `logoBackgroundTransparent` is `false` |
| Backgroud Image options| ---|--- |---|---|
| **backgroundImage** | N | String | `undefined` | Background Image Path or Base64 encoded image. If use relative address, relative to `easy.qrcode.min.js` |
| **backgroundImageAlpha** | N | Number | `1.0` | Background image transparency. Ranges: `0-1.0` |
| **autoColor** | N | Boolean | `false` | Automatic color adjustment(for data block) |
| **autoColorDark** | N | String | `rgba(0, 0, 0, .6)` | Automatic color: dark CSS color |
| **autoColorLight** | N | String | `rgba(255, 255, 255, .7)` | Automatic color: light CSS color |
| Posotion Pattern Color options| --- | ---|---|---|
| **PO** | N | String | `undefined` | Global Posotion Outer CSS color. if not set, the defaut is `colorDark` |
| **PI** | N | String | `undefined` | Global Posotion Inner CSS color. if not set, the defaut is `colorDark` |
| **PO_TL** | N | String | `undefined` | Posotion Outer CSS color - Top Left |
| **PI_TL** | N | String | `undefined` | Posotion Inner CSS color - Top Left |
| **PO_TR** | N | String | `undefined` | Posotion Outer CSS color - Top Right |
| **PI_TR** | N | String | `undefined` | Posotion Inner CSS color - Top Right |
| **PO_BL** | N | String | `undefined` | Posotion Outer CSS color - Bottom Left |
| **PI_BL** | N | String | `undefined` | Posotion Inner CSS color - Bottom Left |
| Alignment Color options| --- |--- |---|---|
| **AO** | N | String | `undefined` | Alignment Outer CSS color. if not set, the defaut is `colorDark` |
| **AI** | N | String | `undefined` | Alignment Inner CSS color. if not set, the defaut is `colorDark` |
| Timing Pattern Color options| --- | ---|---|---|
| **timing** | N | String | `undefined` | Global Timing CSS color. if not set, the defaut is `colorDark` |
| **timing_H** | N | String | `undefined` | Horizontal timing CSS color |
| **timing_V** | N | String | `undefined` | Vertical timing CSS color |
| Title options| --- | ---|---|---|
| **title** | N | String | `''` | |
| **titleFont** | N | String | `normal normal bold 16px Arial` | CSS Font |
| **titleColor** | N | String | `#000000` | CSS color |
| **titleBackgroundColor** | N | String | `#ffffff` | CSS color|
| **titleHeight** | N | Number | `0` | Title Height, Include subTitle |
| **titleTop** | N | Number | `30` | draws y coordinates.|
| SubTitle options| --- | ---|---|---|
| **subTitle** | N | String | `''` | |
| **subTitleFont** | N | String | `normal normal normal 14px Arial` | CSS Font |
| **subTitleColor** | N | String | `#4F4F4F` | CSS color |
| **subTitleTop** | N | Number | `0` | draws y coordinates. default is 0|
| Event Handler options| --- | ---|---|---|
| **onRenderingStart(qrCodeOptions)** | N | Function | `undefined` | Callback function when rendering start work. can use to hide loading state or handling. |
| Images format options| --- | ---|---|---|
| **format** | N | String | `PNG` | 'PNG' or 'JPG' |
| **compressionLevel** | N | Number | `6` | ZLIB compression level between 0 and 9. (**PNGs only**) |
| **quality** | N | Number | `0.75` | An object specifying the quality (0 to 1). (**JPGs only**) |
| Version options| --- | ---|---|---|
| **version** | N | Number | `0` | The symbol versions of QR Code range from Version `1` to Version `40`. default 0 means automatically choose the closest version based on the text length. [Information capacity and versions of QR Codes](https://www.qrcode.com/en/about/version.html) **NOTE**: If you set a value less than the minimum version available for text, the minimum version is automatically used. |
| UTF-8 options| --- | ---|---|---|
| **utf8WithoutBOM** | N | Boolean | `true` | Use UTF-8 without BOM. set to `false` value will use BOM in UFT-8.|
| Binary(hex) data model options| --- | ---|---|---|
| **binary** | N | Boolean | `false` | Whether it is binary mode, default is text mode. |
### Methods- **saveImage(ImagesFormatOptions)**
```JS
// Save PNG Images to file
qrcode.saveImage({
path: 'q.png' // file path
}).then(data=>{
console.log("`q-premium1.png` has been Created!");
});
```- **saveSVG(ImagesFormatOptions)**
```JS
// Save SVG to file
qrcode.saveSVG({
path: 'qrcode.svg' // file path
}).then(data=>{
console.log("`qrcode.svg` has been Created!");
});
```
- **toDataURL()**
```JS
// Get standard base64 image data url text: 'data:image/png;base64, ...'
qrcode.toDataURL().then(data=>{
console.info('======QRCode PNG Base64 DataURL======')
console.info(data);
});
```
- **toSVGText()**
```JS
// Get SVG data text: '{
console.info('======QRCode SVG Data Text======')
console.info(data)
});
```
- **toStream()**
```JS
const out = fs.createWriteStream(`qrcode-stream.png`);
// const stream = await qrcode.toStream();
// stream.pipe(out);
// out.on('finish', () => console.log('Finsihed'));qrcode.toStream().then(res=>{
res.pipe(out).on('finish', () => console.log('Finsihed'));
})
```
## TypeScript SupportUpdate to version `3.7.1+`.
```Javascript
import QRCode = require("easyqrcodejs-nodejs")
```## License
MIT License## EasyQRCodeJS-NodeJS-Premium
*Let you draw freely!*
**EasyQRCodeJS-Premium** is a more powerful and comprehensive enterprise version. You can use Canvas to customize any element, such as eye frame shape, eyeball shape, QR code block shape, and more. Also supports excavation (to prevent the QRcode overlap with the logo), random block mode.
If you need more functions, we can provide you with customized development of API libraries or products. please contact me to buy the business enterprise edition.
**EasyQRCodeJS-Premium** 是功能更加强大和全面的商业/企业版本。让您可以在 QRCode 中通过 Canvas 自定义任何喜欢的元素,例如 Eye frame 形状, Eye ball 形状, QR Body block 形状等等。 还支持 Logo 挖取(excavation,防止二维码与 Logo 重叠)和 Random bolock mode.
如果您需要更多功能,我们可以为您提供 API 库或产品的定制开发。请联系我购买商业/企业版本。

## End
Email:
[http://www.easyproject.cn](http://www.easyproject.cn "EasyProject Home")
**Donation/捐助:**
支付宝/微信/QQ/云闪付/PayPal
我们相信,每个人的点滴贡献,都将是推动产生更多、更好免费开源产品的一大步。
**感谢慷慨捐助,以支持服务器运行和鼓励更多社区成员。**
We believe that the contribution of each bit by bit, will be driven to produce more and better free and open source products a big step.
**Thank you donation to support the server running and encourage more community members.**