Skip to content

Commit

Permalink
Don't depend on Node Buffers when using browserify
Browse files Browse the repository at this point in the history
  • Loading branch information
twiss committed Nov 13, 2020
1 parent 29a12d1 commit 39599b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/other/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const local_atob = typeof atob === 'undefined' ? (str: string) => Buffer.from(str, 'base64').toString('binary') : atob;
const local_btoa = typeof btoa === 'undefined' ? (str: string) => Buffer.from(str, 'binary').toString('base64') : btoa;
const local_atob = typeof atob === 'undefined' ? (str: string) => require('buffer').Buffer.from(str, 'base64').toString('binary') : atob;
const local_btoa = typeof btoa === 'undefined' ? (str: string) => require('buffer').Buffer.from(str, 'binary').toString('base64') : btoa;

export function string_to_bytes(str: string, utf8: boolean = false): Uint8Array {
var len = str.length,
Expand Down

0 comments on commit 39599b1

Please sign in to comment.