
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
把字符串生成二维码,并以Base64 URL形式输出。 支持白色二维码,即反色二维码。
插件使用了H5的canvas特性进行二维码绘制,最后输出base64 url,因此本插件要求运行环境支持canvas特性即可。
npm install jr-qrcode
<script type="text/javascript" src="dist/jr-qrcode.js"></script>
<script>
var imgBase64 = jrQrcode.getQrBase64('hello world');
</script>
// 方法1:全局引用(window.jrQrcode)
require('jr-qrcode');
// 方法2:变量引用
var jrQrcode = require('jr-qrcode');
// import 引入
import jrQrcode from "jr-qrcode";
方法调用,传入字符串,获取 base64 编码的图片 URL
比如:
var imgBase64 = jrQrcode.getQrBase64('hello world');
接口定义:
var imgBase64 = jrQrcode.getQrBase64(text, options);
/**
@param: text: 要生成二维码的字符,支持中文
@param: options: {
padding : 10, // 二维码四边空白(默认为10px)
width : 256, // 二维码图片宽度(默认为256px)
height : 256, // 二维码图片高度(默认为256px)
correctLevel : QRErrorCorrectLevel.H, // 二维码容错level(默认为高)
reverse : false, // 反色二维码,二维码颜色为上层容器的背景颜色
background : "#ffffff", // 二维码背景颜色(默认白色)
foreground : "#000000" // 二维码颜色(默认黑色)
}
@return: 生成的二维码Base64 URL
*/
QRErrorCorrectLevel = {
L : 1,
M : 0,
Q : 3,
H : 2
};
该项目已支持 TS 的引用,类型声明你可以在这里找到:jr-qrcode.d.ts
If you are using jrQrcode in production, just tell us.
FAQs
qrcode generator
The npm package jr-qrcode receives a total of 366 weekly downloads. As such, jr-qrcode popularity was classified as not popular.
We found that jr-qrcode demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.