Skip to content

Commit

Permalink
docs(NODE-4349): add note about Binary(string) behavior (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Jun 29, 2022
1 parent 9613021 commit 5475378
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ export class Binary {
position!: number;

/**
* Create a new Binary instance.
*
* This constructor can accept a string as its first argument. In this case,
* this string will be encoded using ISO-8859-1, **not** using UTF-8.
* This is almost certainly not what you want. Use `new Binary(Buffer.from(string))`
* instead to convert the string to a Buffer using UTF-8 first.
*
* @param buffer - a buffer object containing the binary data.
* @param subType - the option binary type.
*/
Expand Down

0 comments on commit 5475378

Please sign in to comment.