Fetch a raw readme.md from a public github repository.
With Yarn
yarn add @varandas/fetch-readme
With npm
npm i --save @varandas/fetch-readme
// Usage for commonjs
const { fetchReadme } = require('@varandas/fetch-readme');
fetchReadme({
username: 'Microsoft',
repository: 'TypeScript'
}).then(readme => console.log(readme));
// OR ES2015
import { fetchReadme } from '@varandas/fetch-readme'
(async () => {
const readme = await fetchReadme({
username: 'Microsoft',
repository: 'TypeScript'
})
console.log(readme)
})()
Both username and repository properties are required.
branch
defaults to master
and readme
to README.md
.
const config = {
username: 'andrevarandas',
repository: 'the-repository-name',
branch: 'develop',
readme: 'readme.md'
}
Note The readme file name is case sensitive.