Skip to content

AndreVarandas/fetch-readme

Repository files navigation

Fetch Readme 📖

Fetch a raw readme.md from a public github repository.

npm (scoped) npm

Build Status Codecov Coverage semantic-release Known Vulnerabilities GitHub license

Install

With Yarn

  • yarn add @varandas/fetch-readme

With npm

  • npm i --save @varandas/fetch-readme

Usage

// 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)  
})()

Configuration Options

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.

LICENSE - MIT - André Varandas