npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ymd-serialport-sdk

v0.0.2

Published

云门道web串口连接sdk, 支持指纹采集,卡片读取,身份证读取

Readme

云门道串口连接SDK

初始化

import serial from 'ymd-serialport-sdk'
serial(params);
参数说明
params 类型 Object 参数如下
* api: Api是连接实现层,默认是串口连接(WebApi)

读取身份证(B卡)

import {readBCard} from 'ymd-serialport-sdk'
readBCard().then((data)=>{
    console.log(data.UUID, data.dnCode);
})
参数说明
返回:
{
  UUID: 身份证上的卡号
  dnCode: 卡片dnCode
}

读取nfc卡片(A卡)

import {readACard} from 'ymd-serialport-sdk'
readACard().then((data)=>{
    console.log(data.UUID, data.dnCode);
})
参数说明
入参:
type: String // 卡片类型:0x01普通卡, 0x04加密卡片
返回:
{
  UUID: 卡号
  dnCode: 卡片dnCode
}

读取nfc卡片, 同时支持白卡 支持加密卡, 也支持制卡

import {readCard} from 'ymd-serialport-sdk'
readCard({}).then((data)=>{
    console.log(data.UUID, data.cardId, data.isWhiteCard ,data.dnCode);
})
参数说明
入参:
{
  forceWhiteCard: Boolean //只读白卡,不读加密卡
  write: Boolean //待制卡功能
}
返回:
{
  UUID: 卡号
  dnCode: 卡片dnCode
  cardId: 物理卡号
  isWhiteCard: 是否是白卡
}

指纹模板获取

import {readFinger} from 'ymd-serialport-sdk'
readFinger({fingerId:'0',count: 4}).open(()=>{
    // 串口连接成功后回调
}).process(()=>{
    // 指纹录制时回调
}).then((data)=>{
    //指纹模板获取后触发
})
参数说明
  • fingerId: String 指纹id,这里没有涉及指纹授权,所以可以不填
  • count: Number 指纹采集的次数,默认是4
  • mode: String 模式,默认是 '0'

方法说明:

  • open 方法: 串口连接成功后回调,回调返回参数为空
  • process 方法: 指纹录制时回调,即当每一次指纹录制成功时触发,当采集中返回数据如下
    • code:String: '00':失败 '01'执行完成 '02'指纹采集中 '03'设备繁忙

    • times: String 当前采集的次数

    • action: String 指纹采集动作, '01':放下手指 '02': 放开手指

示例

import serial, {readFinger} from 'ymd-serialport-sdk'
serial();

function recordFinger(){
    const count = 4;
    const step = 0;
    readFinger({count}).open(()=>{
        // animation.init()
    }).process(()=>{
        step++;
        if(steop === count){
            //指纹录制完成
            //animation.playToEnd();
        }else{
            //指纹录制中
            //animation.playTo(step/count)
        }
    }).then((code)=>{
        //指纹同步完成
        console.log(code);
    })
}
// 注意web serialport出于安全考虑,串口连接必须有用户交互点击触发才会生效,系统自动调用会无法连接成功
document.querySelector('#button').addEventListener('click',recordFinger)