New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github-contents

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-contents

Get the contents of a file on github

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

github-contents

Gets the contents of a file from a public Github repo using the github API.

installation
npm install github-contents
example usage
var getContents = require('github-contents');
getContents('lib/xmlrpc-router.js', function (err, contents) {
    console.log(contents);
});
pros
  • uses the official github API and therefore stable (getting files via raw http address is going away).
cons
  • fimited to 60 requests per hour (as per standard github policy for unauthenticated requests).
  • fetches the entire file's contents at once. A streaming method for low memory-consumption would be preferable.
roadmap

At some point I'd like to add a few more methods / options:

  • allow authentication so as to be able to make more requests per hour and/or for getting contents from a private repo
  • add a streaming method for low memory-consumption so that this could be run on a VPS without worrying about memory usage.
  • possibly some other file-related methods, maybe even something like a fs module that works through github transparently

feel free to send PR for the above, other features, etc.

testing

Tests require mocha to be installed.

$ mocha
license

MIT Style License (see LICENSE.txt)

Keywords

FAQs

Package last updated on 16 Jun 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc