2014-06-24 04:00:39 +00:00
|
|
|
var fs;
|
2014-11-03 04:02:42 +00:00
|
|
|
function readFileSync(filename, options) {
|
2014-06-24 04:00:39 +00:00
|
|
|
if(fs === undefined) fs = require('fs');
|
2014-11-03 04:02:42 +00:00
|
|
|
return parse(fs.readFileSync(filename), options);
|
2013-11-26 15:56:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function readSync(blob, options) {
|
2014-06-24 04:00:39 +00:00
|
|
|
switch(options !== undefined && options.type !== undefined ? options.type : "base64") {
|
2014-11-03 04:02:42 +00:00
|
|
|
case "file": return readFileSync(blob, options);
|
|
|
|
case "base64": return parse(s2a(Base64.decode(blob)), options);
|
|
|
|
case "binary": return parse(s2a(blob), options);
|
2013-11-26 15:56:58 +00:00
|
|
|
}
|
|
|
|
return parse(blob);
|
|
|
|
}
|
|
|
|
|