Merge pull request #952 from ericvergnaud/clarify-nodejs-usage
simpler and clearer identification of runtime process (nodejs vs browser)
This commit is contained in:
commit
84588075de
|
@ -34,12 +34,9 @@
|
|||
// when you construct the object.
|
||||
//
|
||||
var InputStream = require('./InputStream').InputStream;
|
||||
try {
|
||||
var fs = require("fs");
|
||||
} catch(ex) {
|
||||
// probably running from browser, no "Node.js/fs" makes sense
|
||||
}
|
||||
|
||||
var isNodeJs = typeof window === 'undefined';
|
||||
var fs = isNodeJs ? require("fs") : null;
|
||||
|
||||
function FileStream(fileName) {
|
||||
var data = fs.readFileSync(fileName, "utf8");
|
||||
InputStream.call(this, data);
|
||||
|
|
Loading…
Reference in New Issue