UNPKG

425 BJavaScriptView Raw
1//
2
3const Client = require("@minodisk/medkit");
4const { html2md } = require("@minodisk/medmd");
5const { toText } = require("./format");
6
7module.exports = (client, postId) => {
8 return new Promise(async (resolve, reject) => {
9 const { html, options } = await client.readPost(postId);
10 await client.close();
11 const body = await html2md(html);
12 resolve(toText({ meta: { id: postId, ...options }, body }));
13 });
14};