Replace deprecated calls in atob and btoa
This commit is contained in:
@ -5,7 +5,7 @@ Decodes a string of data which has been encoded using base-64 encoding.
|
|||||||
Create a `Buffer` for the given string with base-64 encoding and use `Buffer.toString('binary')` to return the decoded string.
|
Create a `Buffer` for the given string with base-64 encoding and use `Buffer.toString('binary')` to return the decoded string.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const atob = str => new Buffer(str, 'base64').toString('binary');
|
const atob = str => Buffer.from(str, 'base64').toString('binary');
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -5,7 +5,7 @@ Creates a base-64 encoded ASCII string from a String object in which each charac
|
|||||||
Create a `Buffer` for the given string with binary encoding and use `Buffer.toString('base64')` to return the encoded string.
|
Create a `Buffer` for the given string with binary encoding and use `Buffer.toString('base64')` to return the encoded string.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const btoa = str => new Buffer(str, 'binary').toString('base64');
|
const btoa = str => new Buffer.from(str, 'binary').toString('base64');
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
const atob = str => new Buffer(str, 'base64').toString('binary');
|
const atob = str => Buffer.from(str, 'base64').toString('binary');
|
||||||
module.exports = atob;
|
module.exports = atob;
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
const btoa = str => new Buffer(str, 'binary').toString('base64');
|
const btoa = str => new Buffer.from(str, 'binary').toString('base64');
|
||||||
module.exports = btoa;
|
module.exports = btoa;
|
||||||
|
|||||||
Reference in New Issue
Block a user