Remove trash
This commit is contained in:
parent
3848ed2c17
commit
20def86d32
5 changed files with 8699 additions and 5684 deletions
|
@ -1,76 +0,0 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at soldair+qrcode@gmail.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
92
README.md
92
README.md
|
@ -1,10 +1,7 @@
|
|||
# node-qrcode
|
||||
> QR code/2d barcode generator.
|
||||
# node-qrcode-lite
|
||||
> QR code/2d barcode generator only lighter.
|
||||
|
||||
[](http://travis-ci.org/soldair/node-qrcode)
|
||||
[](https://www.npmjs.com/package/qrcode)
|
||||
[](https://www.npmjs.com/package/qrcode)
|
||||
[](https://github.com/soldair/node-qrcode/blob/master/license)
|
||||
This is a fork of node-qrcode created by Ryan Day with removed unecessary and bloated dependencies.
|
||||
|
||||
- [Highlights](#highlights)
|
||||
- [Installation](#installation)
|
||||
|
@ -21,7 +18,6 @@
|
|||
|
||||
## Highlights
|
||||
- Works on server and client (and react native with svg)
|
||||
- CLI utility
|
||||
- Save QR code as image
|
||||
- Support for Numeric, Alphanumeric, Kanji and Byte mode
|
||||
- Support for mixed modes
|
||||
|
@ -34,50 +30,19 @@
|
|||
Inside your project folder do:
|
||||
|
||||
```shell
|
||||
npm install --save qrcode
|
||||
npm install --save qrcode-lite
|
||||
```
|
||||
|
||||
or, install it globally to use `qrcode` from the command line to save qrcode images or generate ones you can view in your terminal.
|
||||
or, install it globally to use `qrcode-lite` from the command line to save qrcode-lite images or generate ones you can view in your terminal.
|
||||
|
||||
```shell
|
||||
npm install -g qrcode
|
||||
npm install -g qrcode-lite
|
||||
```
|
||||
|
||||
## Usage
|
||||
### CLI
|
||||
|
||||
```
|
||||
Usage: qrcode [options] <input string>
|
||||
|
||||
QR Code options:
|
||||
-v, --qversion QR Code symbol version (1 - 40) [number]
|
||||
-e, --error Error correction level [choices: "L", "M", "Q", "H"]
|
||||
-m, --mask Mask pattern (0 - 7) [number]
|
||||
|
||||
Renderer options:
|
||||
-t, --type Output type [choices: "png", "svg", "utf8"]
|
||||
-w, --width Image width (px) [number]
|
||||
-s, --scale Scale factor [number]
|
||||
-q, --qzone Quiet zone size [number]
|
||||
-l, --lightcolor Light RGBA hex color
|
||||
-d, --darkcolor Dark RGBA hex color
|
||||
--small Output smaller QR code to terminal [boolean]
|
||||
|
||||
Options:
|
||||
-o, --output Output file
|
||||
-h, --help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
|
||||
Examples:
|
||||
qrcode "some text" Draw in terminal window
|
||||
qrcode -o out.png "some text" Save as png image
|
||||
qrcode -d F00 -o out.png "some text" Use red as foreground color
|
||||
```
|
||||
If not specified, output type is guessed from file extension.<br>
|
||||
Recognized extensions are `png`, `svg` and `txt`.
|
||||
|
||||
### Browser
|
||||
`node-qrcode` can be used in browser through module bundlers like [Browserify](https://github.com/substack/node-browserify) and [Webpack](https://github.com/webpack/webpack) or by including the precompiled bundle present in `build/` folder.
|
||||
`node-qrcode-lite` can be used in browser by including the precompiled bundle present in `build/` folder.
|
||||
|
||||
#### Module bundlers
|
||||
```html
|
||||
|
@ -92,7 +57,7 @@ Recognized extensions are `png`, `svg` and `txt`.
|
|||
|
||||
```javascript
|
||||
// index.js -> bundle.js
|
||||
var QRCode = require('qrcode')
|
||||
var QRCode = require('qrcode-lite')
|
||||
var canvas = document.getElementById('canvas')
|
||||
|
||||
QRCode.toCanvas(canvas, 'sample text', function (error) {
|
||||
|
@ -105,7 +70,7 @@ QRCode.toCanvas(canvas, 'sample text', function (error) {
|
|||
```html
|
||||
<canvas id="canvas"></canvas>
|
||||
|
||||
<script src="/build/qrcode.js"></script>
|
||||
<script src="/build/qrcode-lite.js"></script>
|
||||
<script>
|
||||
QRCode.toCanvas(document.getElementById('canvas'), 'sample text', function (error) {
|
||||
if (error) console.error(error)
|
||||
|
@ -114,24 +79,24 @@ QRCode.toCanvas(canvas, 'sample text', function (error) {
|
|||
</script>
|
||||
```
|
||||
|
||||
If you install through `npm`, precompiled files will be available in `node_modules/qrcode/build/` folder.
|
||||
If you install through `npm`, precompiled files will be available in `node_modules/qrcode-lite/build/` folder.
|
||||
|
||||
The precompiled bundle have support for [Internet Explorer 10+, Safari 5.1+, and all evergreen browsers](https://browserl.ist/?q=defaults%2C+IE+%3E%3D+10%2C+Safari+%3E%3D+5.1).
|
||||
|
||||
### NodeJS
|
||||
Require the module `qrcode`
|
||||
Require the module `qrcode-lite`
|
||||
|
||||
```javascript
|
||||
var QRCode = require('qrcode')
|
||||
var QRCode = require('qrcode-lite')
|
||||
|
||||
QRCode.toDataURL('I am a pony!', function (err, url) {
|
||||
console.log(url)
|
||||
})
|
||||
```
|
||||
|
||||
render a qrcode for the terminal
|
||||
render a qrcode-lite for the terminal
|
||||
```js
|
||||
var QRCode = require('qrcode')
|
||||
var QRCode = require('qrcode-lite')
|
||||
|
||||
QRCode.toString('I am a pony!',{type:'terminal'}, function (err, url) {
|
||||
console.log(url)
|
||||
|
@ -142,7 +107,7 @@ QRCode.toString('I am a pony!',{type:'terminal'}, function (err, url) {
|
|||
Promises and Async/Await can be used in place of callback function.
|
||||
|
||||
```javascript
|
||||
import QRCode from 'qrcode'
|
||||
import QRCode from 'qrcode-lite'
|
||||
|
||||
// With promises
|
||||
QRCode.toDataURL('I am a pony!')
|
||||
|
@ -262,7 +227,7 @@ In this way no segment optimizations will be applied under the hood.<br>
|
|||
Segments list can be passed as an array of object:
|
||||
|
||||
```javascript
|
||||
var QRCode = require('qrcode')
|
||||
var QRCode = require('qrcode-lite')
|
||||
|
||||
var segs = [
|
||||
{ data: 'ABCDEFG', mode: 'alphanumeric' },
|
||||
|
@ -286,8 +251,8 @@ An helper method is provided by the lib through an optional file that you can in
|
|||
**Note:** Support for Kanji mode is only needed if you want to benefit of the data compression, otherwise is still possible to encode kanji using Byte mode (See [Multibyte characters](#multibyte-characters)).
|
||||
|
||||
```javascript
|
||||
var QRCode = require('qrcode')
|
||||
var toSJIS = require('qrcode/helper/to-sjis')
|
||||
var QRCode = require('qrcode-lite')
|
||||
var toSJIS = require('qrcode-lite/helper/to-sjis')
|
||||
|
||||
QRCode.toDataURL(kanjiString, { toSJISFunc: toSJIS }, function (err, url) {
|
||||
console.log(url)
|
||||
|
@ -299,8 +264,8 @@ With precompiled bundle:
|
|||
```html
|
||||
<canvas id="canvas"></canvas>
|
||||
|
||||
<script src="/build/qrcode.min.js"></script>
|
||||
<script src="/build/qrcode.tosjis.min.js"></script>
|
||||
<script src="/build/qrcode-lite.min.js"></script>
|
||||
<script src="/build/qrcode-lite.tosjis.min.js"></script>
|
||||
<script>
|
||||
QRCode.toCanvas(document.getElementById('canvas'),
|
||||
'sample text', { toSJISFunc: QRCode.toSJIS }, function (error) {
|
||||
|
@ -316,7 +281,7 @@ QR Codes can hold arbitrary byte-based binary data. If you attempt to create a b
|
|||
```javascript
|
||||
// Regular array example
|
||||
// WARNING: Element values will be clamped to 0-255 even if your data contains higher values.
|
||||
const QRCode = require('qrcode')
|
||||
const QRCode = require('qrcode-lite')
|
||||
QRCode.toFile(
|
||||
'foo.png',
|
||||
[{ data: [253,254,255], mode: 'byte' }],
|
||||
|
@ -327,7 +292,7 @@ QRCode.toFile(
|
|||
|
||||
```javascript
|
||||
// Uint8ClampedArray example
|
||||
const QRCode = require('qrcode')
|
||||
const QRCode = require('qrcode-lite')
|
||||
|
||||
QRCode.toFile(
|
||||
'foo.png',
|
||||
|
@ -340,7 +305,7 @@ QRCode.toFile(
|
|||
```javascript
|
||||
// Node Buffer example
|
||||
// WARNING: Element values will be clamped to 0-255 even if your data contains higher values.
|
||||
const QRCode = require('qrcode')
|
||||
const QRCode = require('qrcode-lite')
|
||||
|
||||
QRCode.toFile(
|
||||
'foo.png',
|
||||
|
@ -350,7 +315,7 @@ QRCode.toFile(
|
|||
)
|
||||
```
|
||||
|
||||
TypeScript users: if you are using [@types/qrcode](https://www.npmjs.com/package/@types/qrcode), you will need to add a `// @ts-ignore` above the data segment because it expects `data: string`.
|
||||
TypeScript users: if you are using [@types/qrcode-lite](https://www.npmjs.com/package/@types/qrcode-lite), you will need to add a `// @ts-ignore` above the data segment because it expects `data: string`.
|
||||
|
||||
## Multibyte characters
|
||||
Support for multibyte characters isn't present in the initial QR Code standard, but is possible to encode UTF-8 characters in Byte mode.
|
||||
|
@ -378,7 +343,7 @@ Server:
|
|||
|
||||
### Browser API
|
||||
#### `create(text, [options])`
|
||||
Creates QR Code symbol and returns a qrcode object.
|
||||
Creates QR Code symbol and returns a qrcode-lite object.
|
||||
|
||||
##### `text`
|
||||
Type: `String|Array`
|
||||
|
@ -755,16 +720,17 @@ Color of light module. Value must be in hex format (RGBA).<br>
|
|||
<br>
|
||||
|
||||
## GS1 QR Codes
|
||||
There was a real good discussion here about them. but in short any qrcode generator will make gs1 compatible qrcodes, but what defines a gs1 qrcode is a header with metadata that describes your gs1 information.
|
||||
There was a real good discussion here about them. but in short any qrcode-lite generator will make gs1 compatible qrcode-lites, but what defines a gs1 qrcode-lite is a header with metadata that describes your gs1 information.
|
||||
|
||||
https://github.com/soldair/node-qrcode/issues/45
|
||||
https://github.com/soldair/node-qrcode-lite/issues/45
|
||||
|
||||
|
||||
## Credits
|
||||
This lib is based on library "QRCode" by Ryan Day.
|
||||
This lib is based on "QRCode for JavaScript" which Kazuhiko Arase thankfully MIT licensed.
|
||||
|
||||
## License
|
||||
[MIT](https://github.com/soldair/node-qrcode/blob/master/license)
|
||||
[MIT](https://git.nfp.is/TheThing/node-qrcode-lite-lite/src/branch/master/license)
|
||||
|
||||
The word "QR Code" is registered trademark of:<br>
|
||||
DENSO WAVE INCORPORATED
|
||||
|
|
3
license
3
license
|
@ -1,6 +1,7 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012 Ryan Day
|
||||
Copyright (c) 2025 Jonatan Nilsson
|
||||
Copyright for portions of project qrcode-lite are held by Ryan Day, 2012 as part of project qrcode.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
|
14196
package-lock.json
generated
14196
package-lock.json
generated
File diff suppressed because it is too large
Load diff
16
package.json
16
package.json
|
@ -1,9 +1,10 @@
|
|||
{
|
||||
"name": "qrcode",
|
||||
"description": "QRCode / 2d Barcode api with both server side and client side support using canvas",
|
||||
"name": "qrcode-lite",
|
||||
"description": "QRCode Lite / 2d Barcode api with both server side and client side support using canvas with no CLI",
|
||||
"version": "1.5.4",
|
||||
"author": "Ryan Day <soldair@gmail.com>",
|
||||
"author": "Jonatan Nilsson <jonatan@nilsson.is>",
|
||||
"contributors": [
|
||||
"Ryan Day <soldair@gmail.com>",
|
||||
"Vincenzo Greco <greco.vincenzo@gmail.com>",
|
||||
"Linus Unnebäck <linus@folkdatorn.se>"
|
||||
],
|
||||
|
@ -19,7 +20,6 @@
|
|||
"fs": false
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"build",
|
||||
"lib",
|
||||
"helper"
|
||||
|
@ -34,13 +34,9 @@
|
|||
"prepublish": "npm run build",
|
||||
"browser": "node examples/clientsideserver.js"
|
||||
},
|
||||
"bin": {
|
||||
"qrcode": "./bin/qrcode"
|
||||
},
|
||||
"dependencies": {
|
||||
"dijkstrajs": "^1.0.1",
|
||||
"pngjs": "^5.0.0",
|
||||
"yargs": "^15.3.1"
|
||||
"pngjs": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.9.0",
|
||||
|
@ -55,7 +51,7 @@
|
|||
"htmlparser2": "^4.1.0",
|
||||
"rollup": "^2.6.1",
|
||||
"rollup-plugin-babel": "^4.4.0",
|
||||
"rollup-plugin-terser": "^5.3.0",
|
||||
"rollup-plugin-terser": "^4.0.3",
|
||||
"sinon": "^9.0.2",
|
||||
"standard": "^16.0.4",
|
||||
"tap": "^16.2.0"
|
||||
|
|
Loading…
Reference in a new issue