You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
526 B
18 lines
526 B
var Parser = require('./lib/parser'); |
|
|
|
function getGlobal() { |
|
return (1,eval)('this'); |
|
} |
|
|
|
module.exports = { |
|
create: function(buffer, global) { |
|
global = global || getGlobal(); |
|
if(buffer instanceof global.ArrayBuffer) { |
|
var DOMBufferStream = require('./lib/dom-bufferstream'); |
|
return new Parser(new DOMBufferStream(buffer, 0, buffer.byteLength, true, global)); |
|
} else { |
|
var NodeBufferStream = require('./lib/bufferstream'); |
|
return new Parser(new NodeBufferStream(buffer, 0, buffer.length, true)); |
|
} |
|
} |
|
};
|
|
|