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 🙏

© 2024 – Pkg Stats / Ryan Hefner

idcard-reader

v5.0.0

Published

通过二代身份证机具读取二代身份证信息

Downloads

35

Readme

通用二代身份证读卡


在widnows客户端实现通过二代身份证机具读取二代身份证信息

  • 使用通过 sdtapi.dll 驱动实现对多数机具的读取
  • 通过 node-ffi 实现访问dll读卡接口
  • 通用dll下载地址

安装依赖

npm install node-gyp -g

  • gyp安装比较麻烦,可以先npm安装 windows-build-tools 模块来自动安装相关开发环境和工具

安装

npm install idcard-reader

使用

import * as idcr from '../lib/index'


const opts = {
    dllTxt: 'c:/sdtapi.dll',
    dllImage: 'c:/wltrs.dll',   // 可空 空则不处理头像
    imgSaveDir: '',             // 头像图片生成保存目录 空则使用系统临时目录
}

idcr.init(opts)
  .then((devices) => {
    // 使用第一个机具进行读取
    return idcr.read(devices[0])
      .then(data => {
        console.log(data)
      })
  })
  .catch(console.error)

命令行调用

// 全局安装
npm install -g idcard-reader
// 执行
idc-reader

读取数据结构

{
    base: {
        name: string;       // 姓名
        gender: number;     // 性别 1,2
        genderName: string; // 性别 男,女
        nation: string;     // 民族代码
        nationName: string; // 民族中文
        birth: string;      // 出生日期
        address: string;    // 住址
        idc: string;        // 身份证号
        regorg: string;     // 签发机关
        startdate: string;  // 有效期开始
        enddate: string;    // 有效期结束 日期或者"长期"
    }
    imagePath: string;      // 头像文件路径
    samid: string;          // 机具SAM序列号
}

注意事项

  • 因保护设计,身份证成功读取后必须移出机具读取感应区或者取出插卡,否则下次连接硬件执行找卡会出现找卡失败情况
  • 若系统无法识别 USB 接口的机具,请尝试切换机具到主板 USB2.0 接口
  • 大头照解码可能需要配合机具厂商提供的 WltRS.dll 文件
  • gyp 需要编译为与 dll 相同的 32/64 位版本(通常为32位)

资源

  • 若需合成图片则自行准备以下字体 华文细黑(hwxhei.ttf) 黑体(simhei.ttf) OCR-B 10 BT(ocrb10bt.ttf)
  • 感谢 身份证模板

License

MIT