
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
ngx-scanner-qrcode-single
Advanced tools
This library is built to provide a solution scanner QR code. This library takes in raw images and will locate, extract and parse any QR code found within.
This library is built to provide a solution scanner QR code.
This library takes in raw images and will locate, extract and parse any QR code found within.
This demo Github, Stackblitz.
Install ngx-scanner-qrcode-single
from npm
:
npm install ngx-scanner-qrcode-single@<version> --save
Add wanted package to NgModule imports:
import { NgxScannerQrcodeModule } from 'ngx-scanner-qrcode-single';
@NgModule({
imports: [
NgxScannerQrcodeModule
]
})
In the Component:
<!-- For camera -->
<ngx-scanner-qrcode-single #action="scanner"></ngx-scanner-qrcode-single>
<!-- data -->
<span>{{ action.data.value | json }}</span><!-- value -->
<span>{{ action.data | async | json }}</span><!-- async -->
<!-- Loading -->
<p *ngIf="action.isLoading">⌛ Loading...</p>
<!-- start -->
<button (click)="action.isStart ? action.stop() : action.start()">{{action.isStart ? 'Stop' : 'Start'}}</button>
<!-- For image src -->
<ngx-scanner-qrcode-single #action="scanner" [src]="'https://domain.com/test.png'"></ngx-scanner-qrcode-single>
<span>{{ action.data.value | json }}</span><!-- value -->
<span>{{ action.data | async | json }}</span><!-- async -->
<!-- For select files -->
<input #file type="file" (change)="onSelects(file.files)" [multiple]="'multiple'" [accept]="'.jpg, .png, .gif, .jpeg'"/>
<div *ngFor="let item of qrCodeResult">
<ngx-scanner-qrcode-single #actionFile="scanner" [src]="item.url" [config]="config"></ngx-scanner-qrcode-single>
<p>{{ actionFile.data.value | json }}</p><!-- value -->
<p>{{ actionFile.data | async | json }}</p><!-- async -->
</div>
import { Component } from '@angular/core';
import { NgxScannerQrcodeService, ScannerQRCodeSelectedFiles } from 'ngx-scanner-qrcode-single';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
public qrCodeResult: ScannerQRCodeSelectedFiles[] = [];
public config: ScannerQRCodeConfig = {
constraints: {
video: {
width: window.innerWidth
}
}
};
constructor(private qrcode: NgxScannerQrcodeService) { }
public onSelects(files: any) {
this.qrcode.loadFiles(files).subscribe((res: ScannerQRCodeSelectedFiles[]) => {
this.qrCodeResult = res;
});
}
}
<!-- For select files -->
<input #file type="file" (change)="onSelects(file.files)" [multiple]="'multiple'" [accept]="'.jpg, .png, .gif, .jpeg'"/>
<div *ngFor="let item of qrCodeResult">
<img [src]="item.url | safe: 'url'" [alt]="item.name" style="max-width: 100%"><!-- Need bypassSecurityTrustUrl -->
<p>{{ item.data | json }}</p>
</div>
import { Component } from '@angular/core';
import { NgxScannerQrcodeService, ScannerQRCodeSelectedFiles } from 'ngx-scanner-qrcode-single';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
public qrCodeResult: ScannerQRCodeSelectedFiles[] = [];
public config: ScannerQRCodeConfig = {
constraints: {
video: {
width: window.innerWidth
}
}
};
constructor(private qrcode: NgxScannerQrcodeService) { }
public onSelects(files: any) {
this.qrcode.loadFilesToScan(files).subscribe((res: ScannerQRCodeSelectedFiles[]) => {
this.qrCodeResult = res;
});
}
}
Field | Description | Type | Default |
---|---|---|---|
[src] | image url | string | - |
[fps] | fps/ms | number | 30 |
[vibrate] | vibrate for mobile | number | 300 |
[isBeep] | beep | boolean | true |
[constraints] | setting video | MediaStreamConstraints | {audio:false,video:true} |
[canvasStyles] | setting canvas | CanvasRenderingContext2D | {font:'15px serif',lineWidth:1,strokeStyle:'green',fillStyle:'#55f02880'} |
[config] | config | ScannerQRCodeConfig | {src:..,fps..,vibrate..,isBeep:..,config:..,constraints:..,canvasStyles:..} |
Field | Description | Type | Default |
---|---|---|---|
(event) | data response | BehaviorSubject | null |
Field | Description | Type | Default |
---|---|---|---|
isStart | status | boolean | false |
isLoading | status | boolean | false |
isTorch | torch | boolean | false |
isPause | status | boolean | - |
isReady | status wasm | AsyncSubject | - |
data | data response | BehaviorSubject | null |
devices | data devices | BehaviorSubject<ScannerQRCodeDevice[]> | [] |
deviceIndexActive | device index | number | 0 |
--- | --- | --- | --- |
(start) | start camera | AsyncSubject | - |
(stop) | stop camera | AsyncSubject | - |
(play) | play video | AsyncSubject | - |
(pause) | pause video | AsyncSubject | - |
(torcher) | toggle on/off flashlight | AsyncSubject | - |
(applyConstraints) | set media constraints | AsyncSubject | - |
(getConstraints) | get media constraints | AsyncSubject | - |
(playDevice) | play deviceId | AsyncSubject | - |
(loadImage) | load image from src | AsyncSubject | - |
(download) | download image | AsyncSubject<ScannerQRCodeSelectedFiles[]> | - |
Field | Description | Type | Default |
---|---|---|---|
(loadFiles) | Convert files | AsyncSubject<ScannerQRCodeSelectedFiles[]> | [] |
(loadFilesToScan) | Scanner files | AsyncSubject<ScannerQRCodeSelectedFiles[]> | [] |
interface ScannerQRCodeConfig {
src?: string;
fps?: number;
vibrate?: number /** support mobile */;
isBeep?: boolean;
constraints?: MediaStreamConstraints;
canvasStyles?: CanvasRenderingContext2D;
}
interface ScannerQRCodeDevice {
kind: string;
label: string;
groupId: string;
deviceId: string;
}
class ScannerQRCodeResult {
binaryData: number[];
data: string;
chunks: Chunks;
version: number;
location: {
topRightCorner: Point;
topLeftCorner: Point;
bottomRightCorner: Point;
bottomLeftCorner: Point;
topRightFinderPattern: Point;
topLeftFinderPattern: Point;
bottomLeftFinderPattern: Point;
bottomRightAlignmentPattern?: Point | undefined;
};
}
interface Point {
x: number;
y: number;
}
declare type Chunks = Array<Chunk | ByteChunk | ECIChunk>;
interface ScannerQRCodeSelectedFiles {
url: string;
name: string;
file: File;
data?: ScannerQRCodeResult;
canvas?: HTMLCanvasElement;
}
Support versions | |
---|---|
Angular 6 | 1.0.0 |
Author Information | |
---|---|
Author | DaiDH |
Phone | +84845882882 |
Country | Vietnam |
Bitcoin |
---|
![]() |
MIT License. Copyright (C) 2023.
FAQs
This library is built to provide a solution scanner QR code. This library takes in raw images and will locate, extract and parse any QR code found within.
We found that ngx-scanner-qrcode-single 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.