@@ -173,8 +173,8 @@ string into a `Buffer` as decoding.
173173 encoding a ` Buffer ` to a string, this encoding will omit padding.
174174
175175* ` 'hex' ` : Encode each byte as two hexadecimal characters. Data truncation
176- may occur when decoding strings that do exclusively contain valid hexadecimal
177- characters. See below for an example.
176+ may occur when decoding strings that do not exclusively consist of an even
177+ number of hexadecimal characters. See below for an example.
178178
179179The following legacy character encodings are also supported:
180180
@@ -199,11 +199,11 @@ The following legacy character encodings are also supported:
199199``` mjs
200200import { Buffer } from ' buffer' ;
201201
202- Buffer .from (' 1ag ' , ' hex' );
202+ Buffer .from (' 1ag123 ' , ' hex' );
203203// Prints <Buffer 1a>, data truncated when first non-hexadecimal value
204204// ('g') encountered.
205205
206- Buffer .from (' 1a7g ' , ' hex' );
206+ Buffer .from (' 1a7 ' , ' hex' );
207207// Prints <Buffer 1a>, data truncated when data ends in single digit ('7').
208208
209209Buffer .from (' 1634' , ' hex' );
@@ -213,11 +213,11 @@ Buffer.from('1634', 'hex');
213213``` cjs
214214const { Buffer } = require (' buffer' );
215215
216- Buffer .from (' 1ag ' , ' hex' );
216+ Buffer .from (' 1ag123 ' , ' hex' );
217217// Prints <Buffer 1a>, data truncated when first non-hexadecimal value
218218// ('g') encountered.
219219
220- Buffer .from (' 1a7g ' , ' hex' );
220+ Buffer .from (' 1a7 ' , ' hex' );
221221// Prints <Buffer 1a>, data truncated when data ends in single digit ('7').
222222
223223Buffer .from (' 1634' , ' hex' );
0 commit comments