gist-files-content
Given JSON returned by a github containing particular gist information it returns its files content.
Last updated 8 years ago by thlorenz .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install gist-files-content 
SYNC missed versions from official npm registry.

gist-files-content build status

Given JSON returned by a github containing particular gist information it returns its files content.

var filesContent = require('..')
  , fs = require('fs');

fs.createReadStream(__dirname + '/two-files.json', { encoding: 'utf-8' })
  .pipe(filesContent())
  .pipe(process.stdout);
content of file1.js ....
.
content of file2.js ...

If more than one file is contained in the gist, the contents of the files are separated by a line containing only ..

Example with file filter

var filesContent = require('..')
  , fs = require('fs');

fs.createReadStream(__dirname + '/two-files.json', { encoding: 'utf-8' })
  .pipe(filesContent({ filter: 'file1.js' }))
  .pipe(process.stdout);
content of file 1 ....

API

/**
 * Takes gist json_ string, pulls out content for each file 
 * and prints them separated by '.' line.
 * If json_ string is not given, it will return a stream that transforms 
 * gist json into files contents string instead.
 * 
 * If a filter is supplied via opts, only these files contents will be returned.
 *
 * @name exports
 * @function
 * @param json_ {String}
 * @param opts {Object} { filter {String|Array} }
 * @return {String|Stream}
 */

Current Tags

  • 0.1.1                                ...           latest (8 years ago)

2 Versions

  • 0.1.1                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |