![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
qrphinx
Advanced tools
Readme
Available on npm.
npm install qrphinx --save
// ES6 import
import qrPhinx from "qrphinx" || import qrPhinx, { QRCode } from 'qrphinx';
// CommonJS require
const qrPhinx = require("qrphinx");
qrPhinx(...);
Alternatively for frontend use qrPhinx.js
can be included with a script tag
<script src="qrPhinx.js"></script>
<script>
qrPhinx(...);
</script>
If you want to use qrPhinx to scan a webcam stream you'll need to extract the ImageData
from the video stream. This can then be passed to qrPhinx. For more advanced questions you can refer to the getUserMedia
docs or the fairly comprehensive webRTC sample code, both of which are great resources for consuming a webcam stream.
qrPhinx exports a method that takes in 3 arguments representing the image data you wish to decode. Additionally can take an options object to further configure scanning behavior.
const code = qrPhinx(imageData, width, height, options?);
if (code) {
console.log("Found QR code", code);
}
imageData
- An Uint8ClampedArray
of RGBA pixel values in the form [r0, g0, b0, a0, r1, g1, b1, a1, ...]
.
As such the length of this array should be 4 * width * height
.
This data is in the same form as the ImageData
interface, and it's also commonly returned by node modules for reading images.width
- The width of the image you wish to decode.height
- The height of the image you wish to decode.options
(optional) - Additional options.
inversionAttempts
- (attemptBoth
(default), dontInvert
, onlyInvert
, or invertFirst
) - Should qrPhinx attempt to invert the image to find QR codes with white modules on black backgrounds instead of the black modules on white background. This option defaults to attemptBoth
for backwards compatibility but causes a ~50% performance hit, and will probably be default to dontInvert
in future versions.If a QR is able to be decoded the library will return an object with the following keys.
binaryData
- Uint8ClampedArray
- The raw bytes of the QR code.data
- The string version of the QR code data.location
- An object with keys describing key points of the QR code. Each key is a point of the form {x: number, y: number}
.
Has points for the following locations.
topRightCorner
/topLeftCorner
/bottomRightCorner
/bottomLeftCorner
;topRightFinderPattern
/topLeftFinderPattern
/bottomLeftFinderPattern
bottomRightAlignmentPattern
assuming one exists and can be located.Because the library is written in typescript you can also view the type definitions to understand the API.
Tests can be run with
npm test
Besides unit tests the test suite contains several hundred images that can be found in the /tests/end-to-end/ folder. After testing any changes, you can compile the production version by running
npm run-script build
FAQs
Locate, extract and parse any QR code
The npm package qrphinx receives a total of 1 weekly downloads. As such, qrphinx popularity was classified as not popular.
We found that qrphinx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.