@@ -173,8 +173,8 @@ string into a `Buffer` as decoding.
173
173
encoding a ` Buffer ` to a string, this encoding will omit padding.
174
174
175
175
* ` '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.
178
178
179
179
The following legacy character encodings are also supported:
180
180
@@ -199,11 +199,11 @@ The following legacy character encodings are also supported:
199
199
``` mjs
200
200
import { Buffer } from ' buffer' ;
201
201
202
- Buffer .from (' 1ag ' , ' hex' );
202
+ Buffer .from (' 1ag123 ' , ' hex' );
203
203
// Prints <Buffer 1a>, data truncated when first non-hexadecimal value
204
204
// ('g') encountered.
205
205
206
- Buffer .from (' 1a7g ' , ' hex' );
206
+ Buffer .from (' 1a7 ' , ' hex' );
207
207
// Prints <Buffer 1a>, data truncated when data ends in single digit ('7').
208
208
209
209
Buffer .from (' 1634' , ' hex' );
@@ -213,11 +213,11 @@ Buffer.from('1634', 'hex');
213
213
``` cjs
214
214
const { Buffer } = require (' buffer' );
215
215
216
- Buffer .from (' 1ag ' , ' hex' );
216
+ Buffer .from (' 1ag123 ' , ' hex' );
217
217
// Prints <Buffer 1a>, data truncated when first non-hexadecimal value
218
218
// ('g') encountered.
219
219
220
- Buffer .from (' 1a7g ' , ' hex' );
220
+ Buffer .from (' 1a7 ' , ' hex' );
221
221
// Prints <Buffer 1a>, data truncated when data ends in single digit ('7').
222
222
223
223
Buffer .from (' 1634' , ' hex' );
0 commit comments