diff --git a/snippets/atob.md b/snippets/atob.md index a397d1955..bde719999 100644 --- a/snippets/atob.md +++ b/snippets/atob.md @@ -7,7 +7,8 @@ lastUpdated: 2020-09-15T16:28:04+03:00 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. +- Use `Buffer.prototype.toString()` to return the decoded string. ```js const atob = str => Buffer.from(str, 'base64').toString('binary'); diff --git a/snippets/btoa.md b/snippets/btoa.md index 8f823884d..2484362ac 100644 --- a/snippets/btoa.md +++ b/snippets/btoa.md @@ -7,7 +7,8 @@ lastUpdated: 2020-09-15T16:28:04+03:00 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. +- Create a `Buffer` for the given string with binary encoding. +- Use `Buffer.prototype.toString()` to return the base-64 encoded string. ```js const btoa = str => Buffer.from(str, 'binary').toString('base64'); diff --git a/snippets/readFileLines.md b/snippets/readFileLines.md index 29f328fca..43bd7fe6c 100644 --- a/snippets/readFileLines.md +++ b/snippets/readFileLines.md @@ -8,8 +8,8 @@ lastUpdated: 2020-10-22T20:24:04+03:00 Returns an array of lines from the specified file. - Use `fs.readFileSync()` to create a `Buffer` from a file. -- Convert buffer to string using `Buffer.toString(encoding)` function. -- Use `String.prototype.split('\n')` to create an array of lines from the contents of the file. +- Use `Buffer.prototype.toString()` to covert the buffer to a string. +- Use `String.prototype.split()` to create an array of lines from the contents of the file. ```js const fs = require('fs');