Skip to content

Latest commit

 

History

History
61 lines (45 loc) · 2.02 KB

README.md

File metadata and controls

61 lines (45 loc) · 2.02 KB

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