Created
February 10, 2022 00:28
-
-
Save renakim/d67b78cd94ce9416d3a5bc93c0d67687 to your computer and use it in GitHub Desktop.
medium-to-markdown file save
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mediumToMarkdown = require("medium-to-markdown"); | |
const fs = require("fs"); | |
const link = <medium post url> | |
// Enter url here | |
mediumToMarkdown.convertFromUrl(link).then(function(markdown) { | |
// console.log(markdown); //=> Markdown content of medium post | |
// medium.com/ 이후의 string 값을 파일명으로 사용 | |
filename = `${link.split("/").slice(-1)[0]}.md`; | |
fs.writeFile(filename, markdown, (err) => { | |
if (err === null) { | |
console.log(`File saved: ${filename}`); | |
} else { | |
console.log(err); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment