ํ๊ธ๊ณผ์ปดํจํฐ์ ํ/๊ธ ๋ฌธ์ ํ์ผ(.hwp)์ ์ฝ๊ณ ํ์ฑํ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋๋ค.
๋ณธ ์ ํ์ ํ๊ธ๊ณผ์ปดํจํฐ์ ํ/๊ธ ๋ฌธ์ ํ์ผ(.hwp) ๊ณต๊ฐ ๋ฌธ์๋ฅผ ์ฐธ๊ณ ํ์ฌ ๊ฐ๋ฐํ์์ต๋๋ค. ๊ณต๊ฐ ๋ฌธ์ ๋ค์ด๋ก๋
- JSON ๋ณํ: HWP ๋ฌธ์ ๊ตฌ์กฐ๋ฅผ JSON์ผ๋ก ์ถ์ถ
- Markdown ๋ณํ: ํ ์คํธ, ํ ์ด๋ธ, ์ด๋ฏธ์ง๋ฅผ ํฌํจํ Markdown ๋ณํ
- HTML ๋ณํ: CSS ์คํ์ผ๋ง์ด ์ ์ฉ๋ ์์ ํ HTML ๋ฌธ์ ์์ฑ
- CLI ๋๊ตฌ: ๋จ์ผ ํ์ผ ๋ณํ, ๋ฐฐ์น ์ฒ๋ฆฌ, ์ด๋ฏธ์ง ์ถ์ถ
- ๋ฉํฐ ํ๋ซํผ: Node.js, Web(WASM), React Native ์ง์
์ด ํ๋ก์ ํธ๋ Bun ์ํฌ์คํ์ด์ค๋ฅผ ์ฌ์ฉํ ๋ชจ๋ ธ๋ ํฌ ๊ตฌ์กฐ์ ๋๋ค.
hwpjs/
โโโ crates/
โ โโโ hwp-core/ # ๊ณต์ Rust ๋ผ์ด๋ธ๋ฌ๋ฆฌ (ํต์ฌ HWP ํ์ฑ ๋ก์ง)
โโโ packages/
โ โโโ hwpjs/ # ๋ฉํฐ ํ๋ซํผ ํจํค์ง (Node.js, Web, React Native)
โโโ examples/ # ์ฌ์ฉ ์์
โ โโโ node/ # Node.js ์์
โ โโโ web/ # Web ์์ (React + Vite)
โ โโโ react-native/ # React Native ์์
โ โโโ cli/ # CLI ์ฌ์ฉ ์์
โโโ documents/ # ๋ฌธ์ ์ฌ์ดํธ (Rspress)
โโโ e2e/ # E2E ํ
์คํธ (Playwright)
- Rust: ํต์ฌ ํ์ฑ/๋ณํ ๋ก์ง
- NAPI-RS: Node.js ๋ค์ดํฐ๋ธ ๋ชจ๋
- Craby: React Native ๋ฐ์ธ๋ฉ
- Bun: ์ํฌ์คํ์ด์ค ๊ด๋ฆฌ
- Rspress: ๋ฌธ์ ์ฌ์ดํธ
npm install @ohah/hwpjsimport { toJson, toMarkdown, toHtml, fileHeader } from '@ohah/hwpjs';
import { readFileSync } from 'fs';
const data = readFileSync('./document.hwp');
// JSON ๋ณํ
const json = toJson(data);
// Markdown ๋ณํ
const { markdown, images } = toMarkdown(data, {
image: 'base64',
useHtml: true,
});
// HTML ๋ณํ
const html = toHtml(data, {
includeVersion: true,
});
// ํ์ผ ํค๋ ์ถ์ถ
const header = fileHeader(data);# ์ ์ญ ์ค์น
npm install -g @ohah/hwpjs
# JSON ๋ณํ
hwpjs to-json document.hwp -o output.json --pretty
# Markdown ๋ณํ
hwpjs to-markdown document.hwp -o output.md --include-images
# HTML ๋ณํ
hwpjs to-html document.hwp -o output.html
# ํ์ผ ์ ๋ณด ํ์ธ
hwpjs info document.hwp
# ์ด๋ฏธ์ง ์ถ์ถ
hwpjs extract-images document.hwp -o ./images
# ๋ฐฐ์น ๋ณํ
hwpjs batch ./documents -o ./output --format json --recursive๋ ์์ธํ ๋ด์ฉ์ CLI ๊ฐ์ด๋๋ฅผ ์ฐธ๊ณ ํ์ธ์.
mise(๋ฏธ์ฆ)๋ฅผ ์ฌ์ฉํ์ฌ ํ์ํ ๋๊ตฌ๋ฅผ ์ค์นํฉ๋๋ค:
mise installbun run test:rust- Rust ํ ์คํธ ์คํbun run test:node- Node.js ํ ์คํธ ์คํbun run dev:docs- ๋ฌธ์ ์ฌ์ดํธ ๊ฐ๋ฐ ์๋ฒbun run dev:web- Web ์์ ๊ฐ๋ฐ ์๋ฒbun run lint- ๋ฆฐํธ ๊ฒ์ฌbun run format- ์ฝ๋ ํฌ๋งทํbun run build- ์ ์ฒด ๋น๋
ํด๋น ๊นํ๋ธ์ ๋จ๊ฒจ์ฃผ์ธ์.
์ด ํ๋ก์ ํธ๋ MIT ๋ผ์ด์ผ์ค๋ฅผ ๋ฐ๋ฆ ๋๋ค.