| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d3de937 commit 28761de
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -114,10 +114,10 @@ function getSource(source, endings) { | |||
| 114 | 114 | ||
| 115 | 115 | // We copy into a new Uint8Array because the underlying | |
| 116 | 116 | // BackingStores are going to be detached and owned by | |
| 117 | - // the Blob. We also don't want to have to worry about | ||
| 118 | - // byte offsets. | ||
| 119 | - source = new Uint8Array(source); | ||
| 120 | - return [source.byteLength, source]; | ||
| 117 | + // the Blob. | ||
| 118 | + const { buffer, byteOffset, byteLength } = source; | ||
| 119 | + const slice = buffer.slice(byteOffset, byteOffset + byteLength); | ||
| 120 | + return [byteLength, new Uint8Array(slice)]; | ||
| 121 | 121 | } | |
| 122 | 122 | ||
| 123 | 123 | class Blob { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -229,3 +229,18 @@ assert.throws(() => new Blob({}), { | |||
| 229 | 229 | }); | |
| 230 | 230 | }); | |
| 231 | 231 | } | |
| 232 | + | ||
| 233 | + (async () => { | ||
| 234 | + const blob = new Blob([ | ||
| 235 | + new Uint8Array([0x50, 0x41, 0x53, 0x53]), | ||
| 236 | + new Int8Array([0x50, 0x41, 0x53, 0x53]), | ||
| 237 | + new Uint16Array([0x4150, 0x5353]), | ||
| 238 | + new Int16Array([0x4150, 0x5353]), | ||
| 239 | + new Uint32Array([0x53534150]), | ||
| 240 | + new Int32Array([0x53534150]), | ||
| 241 | + new Float32Array([0xD341500000]), | ||
| 242 | + ]); | ||
| 243 | + | ||
| 244 | + assert.strictEqual(blob.size, 28); | ||
| 245 | + assert.strictEqual(blob.type, ''); | ||
| 246 | + })().then(common.mustCall()); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments