mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-25 14:26:29 +00:00
27 lines
670 B
JavaScript
27 lines
670 B
JavaScript
'use strict';
|
|
|
|
var streamify = require('stream-array');
|
|
var fs = require('fs');
|
|
|
|
/**
|
|
* A readable source for content that doesn't do dependency resolution, but
|
|
* simply reads files and pushes them onto a stream.
|
|
*
|
|
* This stream requires filesystem access, and thus isn't suitable
|
|
* for a browser environment.
|
|
*
|
|
* @param {Array<string|Object>} indexes entry points
|
|
* @return {ReadableStream} this emits data
|
|
*/
|
|
module.exports = function (indexes) {
|
|
return streamify(indexes.map(function (index) {
|
|
if (typeof index === 'string') {
|
|
return {
|
|
source: fs.readFileSync(index, 'utf8'),
|
|
file: index
|
|
};
|
|
}
|
|
return index;
|
|
}));
|
|
};
|