diff options
author | Kyra <kyradiscord@gmail.com> | 2018-11-04 19:05:02 +0100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-11-04 10:05:02 -0800 |
commit | e93d686e9d5e797f7e4e02bda56a8b6d535326ca (patch) | |
tree | e89490da61e17ee890ce590fdaa99d0701dc8308 /js/blob.ts | |
parent | 1241b8e9babfec3e87c8958e2065966ee5dd1335 (diff) |
Web APIs: `File` and `FormData` (#1056)
Diffstat (limited to 'js/blob.ts')
-rw-r--r-- | js/blob.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/js/blob.ts b/js/blob.ts index b57452dd5..8dcc48ba2 100644 --- a/js/blob.ts +++ b/js/blob.ts @@ -97,6 +97,12 @@ function toUint8Arrays( ret.push(element[bytesSymbol]); } else if (element instanceof Uint8Array) { ret.push(element); + } else if (element instanceof Uint16Array) { + const uint8 = new Uint8Array(element.buffer); + ret.push(uint8); + } else if (element instanceof Uint32Array) { + const uint8 = new Uint8Array(element.buffer); + ret.push(uint8); } else if (ArrayBuffer.isView(element)) { // Convert view to Uint8Array. const uint8 = new Uint8Array(element.buffer); @@ -105,6 +111,8 @@ function toUint8Arrays( // Create a new Uint8Array view for the given ArrayBuffer. const uint8 = new Uint8Array(element); ret.push(uint8); + } else { + ret.push(enc.encode(String(element))); } } return ret; |