This commit is contained in:
Alan K 2014-07-14 20:33:22 +02:00
parent 3733704a15
commit 4811a8575a
4 changed files with 31 additions and 24 deletions

View File

@ -1,6 +1,6 @@
{
"name": "filer",
"version": "0.0.13",
"version": "0.0.14",
"main": "dist/filer.js",
"devDependencies": {
"mocha": "1.17.1",

39
dist/filer.js vendored
View File

@ -965,8 +965,8 @@
}());
}).call(this,_dereq_("FWaASH"))
},{"FWaASH":9}],2:[function(_dereq_,module,exports){
}).call(this,_dereq_("JkpR2F"))
},{"JkpR2F":9}],2:[function(_dereq_,module,exports){
// Based on https://github.com/diy/intercom.js/blob/master/lib/events.js
// Copyright 2012 DIY Co Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
@ -2000,13 +2000,8 @@ function Buffer (subject, encoding, noZero) {
var type = typeof subject
// Workaround: node's base64 implementation allows for non-padded strings
// while base64-js does not.
if (encoding === 'base64' && type === 'string') {
subject = stringtrim(subject)
while (subject.length % 4 !== 0) {
subject = subject + '='
}
subject = base64clean(subject)
}
// Find the length
@ -2037,11 +2032,12 @@ function Buffer (subject, encoding, noZero) {
buf._set(subject)
} else if (isArrayish(subject)) {
// Treat array-ish objects as a byte array
for (i = 0; i < length; i++) {
if (Buffer.isBuffer(subject))
if (Buffer.isBuffer(subject)) {
for (i = 0; i < length; i++)
buf[i] = subject.readUInt8(i)
else
buf.writeInt8(subject[i], i)
} else {
for (i = 0; i < length; i++)
buf[i] = ((subject[i] % 256) + 256) % 256
}
} else if (type === 'string') {
buf.write(subject, 0, encoding)
@ -2962,6 +2958,18 @@ Buffer._augment = function (arr) {
return arr
}
var INVALID_BASE64_RE = /[^+\/0-9A-z]/g
function base64clean (str) {
// Node strips out invalid characters like \n and \t from the string, base64-js does not
str = stringtrim(str).replace(INVALID_BASE64_RE, '')
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
while (str.length % 4 !== 0) {
str = str + '='
}
return str
}
function stringtrim (str) {
if (str.trim) return str.trim()
return str.replace(/^\s+|\s+$/g, '')
@ -3104,7 +3112,6 @@ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
? Uint8Array
: Array
var ZERO = '0'.charCodeAt(0)
var PLUS = '+'.charCodeAt(0)
var SLASH = '/'.charCodeAt(0)
var NUMBER = '0'.charCodeAt(0)
@ -3213,9 +3220,9 @@ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
return output
}
module.exports.toByteArray = b64ToByteArray
module.exports.fromByteArray = uint8ToBase64
}())
exports.toByteArray = b64ToByteArray
exports.fromByteArray = uint8ToBase64
}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
},{}],8:[function(_dereq_,module,exports){
exports.read = function(buffer, offset, isLE, mLen, nBytes) {

12
dist/filer.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@
"idb",
"websql"
],
"version": "0.0.13",
"version": "0.0.14",
"author": "Alan K <ack@modeswitch.org> (http://blog.modeswitch.org)",
"homepage": "http://js-platform.github.io/filer",
"bugs": "https://github.com/js-platform/filer/issues",