From c6a0491c0f4f85c4daf8e2c5a5646b5cf34f2cf0 Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Thu, 4 Oct 2018 03:38:20 +0000 Subject: [PATCH] Travis build: 592 --- README.md | 4 ++-- docs/node.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9291bfd23..ebe62a3d4 100644 --- a/README.md +++ b/README.md @@ -6158,7 +6158,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. ```js -const atob = str => new Buffer(str, 'base64').toString('binary'); +const atob = str => Buffer.from(str, 'base64').toString('binary'); ```
@@ -6179,7 +6179,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. ```js -const btoa = str => new Buffer(str, 'binary').toString('base64'); +const btoa = str => new Buffer.from(str, 'binary').toString('base64'); ```
diff --git a/docs/node.html b/docs/node.html index 0edb294d5..7f0761626 100644 --- a/docs/node.html +++ b/docs/node.html @@ -91,9 +91,9 @@ },1700); } }, false); - }

logo 30 seconds of code Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less.



Node

atob

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.

const atob = str => new Buffer(str, 'base64').toString('binary');
+      }

logo 30 seconds of code Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less.



Node

atob

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.

const atob = str => Buffer.from(str, 'base64').toString('binary');
 
atob('Zm9vYmFy'); // 'foobar'
-

btoa

Creates a base-64 encoded ASCII string from a String object in which each character in the string is treated as a byte of binary data.

Create a Buffer for the given string with binary encoding and use Buffer.toString('base64') to return the encoded string.

const btoa = str => new Buffer(str, 'binary').toString('base64');
+

btoa

Creates a base-64 encoded ASCII string from a String object in which each character in the string is treated as a byte of binary data.

Create a Buffer for the given string with binary encoding and use Buffer.toString('base64') to return the encoded string.

const btoa = str => new Buffer.from(str, 'binary').toString('base64');
 
btoa('foobar'); // 'Zm9vYmFy'
 

colorize

Add special characters to text to print in color in the console (combined with console.log()).

Use template literals and special characters to add the appropriate color code to the string output. For background colors, add a special character that resets the background color at the end of the string.

const colorize = (...args) => ({
   black: `\x1b[30m${args.join(' ')}`,