2014-06-24 04:00:39 +00:00
|
|
|
var fs;
|
2013-11-26 15:56:58 +00:00
|
|
|
function readFileSync(filename) {
|
2014-06-24 04:00:39 +00:00
|
|
|
if(fs === undefined) fs = require('fs');
|
|
|
|
return parse(fs.readFileSync(filename));
|
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") {
|
2013-11-26 15:56:58 +00:00
|
|
|
case "file": return readFileSync(blob);
|
2014-06-24 04:00:39 +00:00
|
|
|
case "base64": return parse(s2a(Base64.decode(blob)));
|
|
|
|
case "binary": return parse(s2a(blob));
|
2013-11-26 15:56:58 +00:00
|
|
|
}
|
|
|
|
return parse(blob);
|
|
|
|
}
|
|
|
|
|