This commit is contained in:
2020-08-15 21:47:14 +08:00
parent 990f649724
commit 55f98eed02
20 changed files with 1451 additions and 3754 deletions

View File

@@ -600,16 +600,14 @@ module.exports = function(data, options) {
},{"./base64":1,"./zipEntries":22}],11:[function(_dereq_,module,exports){
(function (Buffer){
'use strict';
var Buffer_from = /*::(*/function(){}/*:: :any)*/;
if(typeof Buffer !== 'undefined') {
var nbfs = !Buffer.from;
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
// $FlowIgnore
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
// $FlowIgnore
if(!Buffer.alloc) Buffer.alloc = function(n) { return new Buffer(n); };
}
module.exports = function(data, encoding){
return typeof data == 'number' ? Buffer.alloc(data) : Buffer_from(data, encoding);
return typeof data == 'number' ? Buffer.alloc(data) : Buffer.from(data, encoding);
};
module.exports.test = function(b){
return Buffer.isBuffer(b);