@texonom/cli
v1.4.4
Published
Texonom CLI which has ability to export data from Notion.so
Downloads
95
Readme
Texonom Notion CLI
Robust TypeScript client for the unofficial Notion API.
Install
pnpm i @texonom/cli
Usages
Export
## export block, collection, collection_view and notion_user for each folder
pnpm tsx src/main.ts export --raw
Develop
import { NotionExporter } from '@texonom/cli'
const exporter = new NotionExporter({ page: pageId })
const recordMap = await exporter.notion.getPage(pageId)
const md = await exporter.pageToMarkdown(parsePageId(pageId), recordMap)
Example
Export whole workspace
# 1. First get all raw data from the Notion API
pnpm tsx src/main.ts export -p 04089c8ae3534bf79512fc495944b321 --raw -r -f
# 2. After that transform all raw data to markdown
# it requres Notion token if there are missed blocks & spaces & users & collections (No ~ query)
export NOTION_TOKEN=
pnpm tsx src/main.ts export -p 04089c8ae3534bf79512fc495944b321 -r -l -t $NOTION_TOKEN -u
# 3. If there is a rate limit error try without token for anonymous request
pnpm tsx src/main.ts export -p 04089c8ae3534bf79512fc495944b321 -r -l -u
# Iterate the 2-3 commands until collection error is gone (due to the rate limit)
if there is memory error
NODE_OPTIONS="--max-old-space-size=16384" tsx ...
Export a single page
pnpm tsx src/main.ts export -p 04089c8ae3534bf79512fc495944b321