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

feishu2markdown

v1.2.0

Published

feishu document to markdown converter

Downloads

182

Readme

飞书文档转Markdown

Keywords:

飞书文档; 飞书转Markdown; 飞书转MD; nodejs; feishu to markdown; feishu doc to markdown


动机(Motivation)

飞书转markdown还挺麻烦的

功能(Features)

  1. 根据飞书的appId, appSecrete还有文件夹token批量自动处理一组文档;也支持只处理一个文档
  2. 支持处理图片
  3. 提供接口让你方便处理整出来的图片怎么接着二次加工(如上传自己的CDN等)
  4. 复杂的排版不支持,文档最好是从上到下线性的
  5. AI编程友好,不会让他读到你得appId, appSecret

小巧思(Usages)

  1. 你可以用通过这个库把飞书的文件夹文档作为RAG的知识库

安装方法(Installation)

NPM:

npm i --save feishu2markdown

Yarn:

yarn add feishu2markdown

使用方法(How to use)

  1. 去飞书开发者后台申请飞书内部应用 https://open.feishu.cn/
  2. 申请后,为应用申请以下权限:
    1. docx:document:readonly
    2. drive:drive
    3. space:document:retrieve
  3. 如下调用进行测试
    1. 照着 run/example_token.json下的样子,复制一个token.json出来
    2. 把你创建的飞书应用的appId和appSecret都放进去
    3. 执行 npm run test 直接做一个测试;
      1. 成功的话会出现doc.md以及一个如**_images的文件夹,里面都是图片
import handleDoc from "feishu2markdown";
import Token from "./token.json";
import axios from "axios";
import * as fs from "fs";
import * as path from "path";

const { appId, appSecret } = Token;

console.log("App ID:", appId);
console.log("App Secret:", appSecret);

handleDoc({
  type: "feishu",
  appId,
  appSecret,
  docUrl: 'https://xqs4y94tkg.feishu.cn/docx/G6bldPfBQo7nZ7xM3urcKtCPn5c',
  // folderToken: 'V3gHf81UtljFX0drD44cZwzmn4b',
  handleProgress: (completedCount, errorCount, totalCount) => {
    console.log(
      `Progress: ${completedCount}/${totalCount}, Errors: ${errorCount}`,
    );
  },
  handleImage: (url: string) { // local file dir
    return url;
  },
  onDocFinish: (docId, markdown, metdata) => {
    const mdDir = path.resolve(process.cwd(), `./${docId}.md`);
    fs.writeFileSync(mdDir, markdown!);
    console.log(`Document saved: ${mdDir}`, metdata);
  },
});

获取文档列表

import handleDoc, { getDocTaskList } from "feishu2markdwon";


getDocTaskList({
  type: "feishu",
  appId,
  appSecret,
  docUrl: "https://xqs4y94tkg.feishu.cn/docx/G6bldPfBQo7nZ7xM3urcKtCPn5c",
}).then((a) => console.log(a));