Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/magiclen/node-qr-code
Encode QR Code by using N-API.
https://github.com/magiclen/node-qr-code
nodejs qrcode rust
Last synced: 28 days ago
JSON representation
Encode QR Code by using N-API.
- Host: GitHub
- URL: https://github.com/magiclen/node-qr-code
- Owner: magiclen
- License: mit
- Created: 2017-12-21T17:28:40.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-23T06:23:00.000Z (2 months ago)
- Last Synced: 2024-11-19T11:14:46.673Z (about 1 month ago)
- Topics: nodejs, qrcode, rust
- Language: JavaScript
- Homepage:
- Size: 438 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
magic-qr-code
=================================[![CI](https://github.com/magiclen/node-qr-code/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/node-qr-code/actions/workflows/ci.yml)
Encode QR Code by using N-API. The QR code generating library is [QR Code generator library](https://www.nayuki.io/page/qr-code-generator-library "QR Code generator library")
You need to set up the Rust development environment: [rustup](https://rustup.rs/)
## Usage
### Encode QR Code
You can use the `encodeString` function to encode a string or use the `encodeBuffer` function to encode a buffer into QR Code data which is an array of buffers (`Buffer[]`).
```typescript
import { encodeString } from "magic-qr-code";const result = encodeString("https://magiclen.org".toUpperCase());
/*
[
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
]
*/
```Encoding QR code, you can also set the error correction level by passing a `ErrorCorrection` number to the second argument.
```typescript
import { encodeString, ErrorCorrection } from "magic-qr-code";const result = encodeString("https://magiclen.org".toUpperCase(), ErrorCorrection.High);
```## License
[MIT](LICENSE)