From ccd7221500be9a3076f312d4b18365b9b67fcad6 Mon Sep 17 00:00:00 2001 From: Giora Guttsait Date: Wed, 19 Jan 2022 19:46:36 +0200 Subject: [PATCH 1/4] doc: add missing word in `'hex'` Buffer decoding description fixes #41594 --- doc/api/buffer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 80a97ababd2d06..8ef57423ecbdb4 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -175,7 +175,7 @@ string into a `Buffer` as decoding. encoding a `Buffer` to a string, this encoding will omit padding. * `'hex'`: Encode each byte as two hexadecimal characters. Data truncation - may occur when decoding strings that do exclusively contain valid hexadecimal + may occur when decoding strings that do not exclusively contain valid hexadecimal characters. See below for an example. The following legacy character encodings are also supported: From 7c9c04babdb53491c988970f188438b2834d2627 Mon Sep 17 00:00:00 2001 From: Giora Guttsait Date: Wed, 19 Jan 2022 19:51:11 +0200 Subject: [PATCH 2/4] fix max line width lint issue --- doc/api/buffer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 8ef57423ecbdb4..ac47da98eb7980 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -175,8 +175,8 @@ string into a `Buffer` as decoding. encoding a `Buffer` to a string, this encoding will omit padding. * `'hex'`: Encode each byte as two hexadecimal characters. Data truncation - may occur when decoding strings that do not exclusively contain valid hexadecimal - characters. See below for an example. + may occur when decoding strings that do not exclusively contain valid + hexadecimal characters. See below for an example. The following legacy character encodings are also supported: From eb2fcf54780ea95ab9c640d2b89500c514838d62 Mon Sep 17 00:00:00 2001 From: Giora Guttsait Date: Wed, 19 Jan 2022 20:52:58 +0200 Subject: [PATCH 3/4] Update buffer.md --- doc/api/buffer.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index ac47da98eb7980..03d2f920907fbd 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -175,8 +175,8 @@ string into a `Buffer` as decoding. encoding a `Buffer` to a string, this encoding will omit padding. * `'hex'`: Encode each byte as two hexadecimal characters. Data truncation - may occur when decoding strings that do not exclusively contain valid - hexadecimal characters. See below for an example. + may occur when decoding strings that do not exclusively consist of an even + number of hexadecimal characters. See below for an example. The following legacy character encodings are also supported: @@ -201,11 +201,11 @@ The following legacy character encodings are also supported: ```mjs import { Buffer } from 'buffer'; -Buffer.from('1ag', 'hex'); +Buffer.from('1ag123', 'hex'); // Prints , data truncated when first non-hexadecimal value // ('g') encountered. -Buffer.from('1a7g', 'hex'); +Buffer.from('1a7', 'hex'); // Prints , data truncated when data ends in single digit ('7'). Buffer.from('1634', 'hex'); @@ -219,7 +219,7 @@ Buffer.from('1ag', 'hex'); // Prints , data truncated when first non-hexadecimal value // ('g') encountered. -Buffer.from('1a7g', 'hex'); +Buffer.from('1a7', 'hex'); // Prints , data truncated when data ends in single digit ('7'). Buffer.from('1634', 'hex'); From 02371aa273f56d4dd64f60c23ad86b887b2914cc Mon Sep 17 00:00:00 2001 From: Giora Guttsait Date: Wed, 19 Jan 2022 20:55:03 +0200 Subject: [PATCH 4/4] Update buffer.md --- doc/api/buffer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 03d2f920907fbd..1bb5b5eb23047e 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -215,7 +215,7 @@ Buffer.from('1634', 'hex'); ```cjs const { Buffer } = require('buffer'); -Buffer.from('1ag', 'hex'); +Buffer.from('1ag123', 'hex'); // Prints , data truncated when first non-hexadecimal value // ('g') encountered.