Skip to content

Commit aed4360

Browse files
authored
Merge pull request #40 from val-town/master
Update base64 imports
2 parents 795ed5b + 7504367 commit aed4360

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

deno/StructureClone.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { encode, decode } from 'https://deno.land/std/encoding/base64.ts';
1+
import {
2+
encodeBase64,
3+
decodeBase64,
4+
} from 'https://deno.land/std/encoding/base64.ts';
25
import { Transferrable } from './MessageTarget.ts';
36
import { MessagePort, MessageChannel } from './MessageChannel.ts';
47

@@ -85,7 +88,7 @@ function _serializeObject(value: unknown, map: Map<any, MapRef>) {
8588
value instanceof Int32Array
8689
) {
8790
let ref = {
88-
root: encode(
91+
root: encodeBase64(
8992
new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
9093
),
9194
type: value.constructor.name,
@@ -98,7 +101,7 @@ function _serializeObject(value: unknown, map: Map<any, MapRef>) {
98101
return [id];
99102
} else if (value instanceof ArrayBuffer) {
100103
let ref = {
101-
root: encode(new Uint8Array(value)),
104+
root: encodeBase64(new Uint8Array(value)),
102105
type: value.constructor.name,
103106
} as Ref;
104107
(<any>map)[HAS_CIRCULAR_REF_OR_TRANSFERRABLE] = true;
@@ -264,7 +267,7 @@ function _deserializeRef(
264267
'Int32Array',
265268
];
266269
if (types.indexOf(refData.type) >= 0) {
267-
const bytes = new Uint8Array(decode(refData.root));
270+
const bytes = new Uint8Array(decodeBase64(refData.root));
268271
const final =
269272
refData.type == 'Uint8Array'
270273
? bytes

0 commit comments

Comments
 (0)