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

doc2x

v0.0.2

Published

A template for creating npm packages using TypeScript and VSCode

Readme

DOC2X SDK

English 中文

开始使用 doc2x

npm install doc2x

前置条件:key 的获取可以在doc2x中获取

使用方法

import { Doc2x } from 'doc2x';

const doc2x = new Doc2x({
  key: 'your key',
});

await doc2x.init();

// 获取token
const token = await doc2x.token;
// 获取refreshToken
const refreshToken = await doc2x.refreshToken;
// 查看剩余次数
const remain = await doc2x.remain();
console.log(remain);

//   const filePath = path.resolve(__dirname, 'test.pdf');
//   const fileContent = fs.createReadStream(filePath);
//异步上传pdf文件
const res = await doc2x.asyncPdf({
  file: filePath,
});
/**
 * res:AsyncPdfResponse
 * {
 *  "code": 0,
 *  "message": "success",
 *  "data": {
 *  "uuid": "返回uuid"
 *  }
 * }
 */
console.log(res);

// 使用获取的uuid查询进度
const status = await doc2x.asyncStatus(res.data.uuid);

// 同步上传pdf文件
const res = await doc2x.pdf({
  file: filePath,
  callback:{
        onProgress:(res)=>{
            console.log('progress',res.progress);
            console.log('result',res.result);
            console.log('version',res.result.version)
            console.log('pages',res.result.pages);
        }
        onSuccess:(res)=>{
            console.log(res);
        }
  }
});

目前支持 API

  • /asyncPdf:异步上传 pdf 文件
  • /asyncStatus:查询异步上传 pdf 文件的状态
  • /pdf:同步上传 pdf 文件
  • remain:查看剩余次数

测试

npm run test

File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------------------------------------------------------------
All files |      47 |        0 |      55 |   46.39 |
 index.ts |      47 |        0 |      55 |   46.39 | 67,71,92,97,103,127,133-134,144-165,177-203,219-232,271-272,295,301-302
----------|---------|----------|---------|---------|-------------------------------------------------------------------------
Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        3.498 s, estimated 4 s