{"id":13583444,"url":"https://github.com/doowb/github-content","last_synced_at":"2025-05-05T03:43:32.095Z","repository":{"id":65990615,"uuid":"46129288","full_name":"doowb/github-content","owner":"doowb","description":"Easily download files from github raw user content.","archived":false,"fork":false,"pushed_at":"2017-09-11T14:50:31.000Z","size":18,"stargazers_count":25,"open_issues_count":2,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-05T03:43:21.745Z","etag":null,"topics":["contents","download","file","files","github","node","nodejs","rawcontent"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doowb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-11-13T15:17:04.000Z","updated_at":"2025-04-09T11:31:00.000Z","dependencies_parsed_at":"2023-03-10T01:30:22.033Z","dependency_job_id":null,"html_url":"https://github.com/doowb/github-content","commit_stats":{"total_commits":22,"total_committers":1,"mean_commits":22.0,"dds":0.0,"last_synced_commit":"1348f808083d14dde4f986ff9f93ee543183e1d3"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgithub-content","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgithub-content/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgithub-content/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgithub-content/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doowb","download_url":"https://codeload.github.com/doowb/github-content/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252436240,"owners_count":21747467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contents","download","file","files","github","node","nodejs","rawcontent"],"created_at":"2024-08-01T15:03:29.016Z","updated_at":"2025-05-05T03:43:32.075Z","avatar_url":"https://github.com/doowb.png","language":"JavaScript","readme":"# github-content [![NPM version](https://img.shields.io/npm/v/github-content.svg?style=flat)](https://www.npmjs.com/package/github-content) [![NPM monthly downloads](https://img.shields.io/npm/dm/github-content.svg?style=flat)](https://npmjs.org/package/github-content)  [![NPM total downloads](https://img.shields.io/npm/dt/github-content.svg?style=flat)](https://npmjs.org/package/github-content) [![Linux Build Status](https://img.shields.io/travis/doowb/github-content.svg?style=flat\u0026label=Travis)](https://travis-ci.org/doowb/github-content) [![Windows Build Status](https://img.shields.io/appveyor/ci/doowb/github-content.svg?style=flat\u0026label=AppVeyor)](https://ci.appveyor.com/project/doowb/github-content)\n\n\u003e Easily download files from github raw user content.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save github-content\n```\n\n## Usage\n\n```js\nvar githubContent = require('github-content');\n```\n\n## API\n\n### [GithubContent](index.js#L33)\n\nCreate an instance of GithubContent to setup downloading of files.\n\n**Params**\n\n* `options` **{Object}**: Options to set on instance. Additional options passed to [github-base](https://github.com/jonschlinkert/github-base)\n* `options.owner` **{String}**: Set the owner to be used for each file.\n* `options.repo` **{String}**: Set the repository to be used for each file.\n* `options.branch` **{String}**: Set the branch to be used for each file. Defaults to `master`\n\n**Example**\n\n```js\nvar options = {\n  owner: 'doowb',\n  repo: 'github-content',\n  branch: 'master' // defaults to master\n};\n\nvar gc = new GithubContent(options);\n```\n\n### [.file](index.js#L73)\n\nDownload a single file given the file name and repository options. File object returned will contain a `.path` property with the file path passed in and a `.contents` property with the contents of the downloaded file.\n\n**Params**\n\n* `path` **{String}**: file path to download\n* `options` **{Object}**: Additional options to base to [github-base](https://github.com/jonschlinkert/github-base) `.get` method.\n* `cb` **{Function}**: Callback function taking `err` and `file`\n* `returns` **{Object}** `this`: to enable chaining\n\n**Example**\n\n```js\ngc.file('package.json', function(err, file) {\n  if (err) return console.log(err);\n  console.log(file.path);\n  console.log(file.contents);\n});\n//=\u003e package.json\n//=\u003e {\n//=\u003e   \"name\": \"github-content\"\n//=\u003e   ...\n//=\u003e }\n```\n\n### [.files](index.js#L129)\n\nDownload an array of files using the previous settings and the passed in file names. File objects returned will contain a `.path` property with the file path passed in and a `.contents` property with the contents of the downloaded file.\n\n**Params**\n\n* `files` **{String|Array}**: files to download\n* `options` **{Object}**: Additional options to base to [github-base](https://github.com/jonschlinkert/github-base) `.get` method.\n* `cb` **{Function}**: Callback function taking `err` and `files`\n* `returns` **{Object}** `this`: to enable chaining\n\n**Example**\n\n```js\ngc.files(['package.json', 'index.js'], function(err, files) {\n  if (err) return console.log(err);\n  console.log(files.length);\n  console.log(files[0].path);\n  console.log(files[0].contents);\n});\n//=\u003e 2\n//=\u003e package.json\n//=\u003e {\n//=\u003e   \"name\": \"github-content\"\n//=\u003e   ...\n//=\u003e }\n```\n\n## About\n\n### Related projects\n\n[github-base](https://www.npmjs.com/package/github-base): JavaScript wrapper that greatly simplifies working with GitHub's API. | [homepage](https://github.com/jonschlinkert/github-base \"JavaScript wrapper that greatly simplifies working with GitHub's API.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Brian Woodward**\n\n* [github/doowb](https://github.com/doowb)\n* [twitter/doowb](https://twitter.com/doowb)\n\n### License\n\nCopyright © 2017, [Brian Woodward](https://github.com/doowb).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on September 11, 2017._","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fgithub-content","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoowb%2Fgithub-content","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fgithub-content/lists"}