Socket
Book a DemoInstallSign in
Socket

github-stream

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-stream

Stream updates to the files in a GitHub repository.

Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
1
-75%
Maintainers
1
Weekly downloads
 
Created
Source

github-stream

Get a stream of updates to a GitHub repository.

Build Status Dependency Status NPM version

Installation

npm install github-stream

API

To construct the stream use:

'use strict';

var Repository = require('github-stream');

var stream = new Repository(USER, REPO, GITHUB_TOKEN, options);

stream.on('data', function (update) {
  console.dir(update);
  // { type: 'Directory', action: 'Create', path: '/my-dir' }
  // { type: 'Directory', action: 'Delete', path: '/my-old-dir' }
  // { type: 'File', action: 'Create', path: '/my-new-file', body: Buffer}
  // { type: 'File', action: 'Update', path: '/my-file', body: Buffer}
  // { type: 'File', action: 'Delete', path: '/my-old-file'}
});

In order to keep track of updates, this module keeps the sha hashes of each file in memory. By default it polls github once per second, but it correctly handles caching such that the requests only count when there are updates to retrieve.

Note also that each file is transferred wholesale as a Buffer, not as a stream. This is much more convenient but can add significant memory footprint.

License

MIT

FAQs

Package last updated on 20 Apr 2014

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