through2.obj makes an object stream (or a stream in object mode). Through an object stream objects flow, not buffers. What you get is not a buffer, but an object obj. That is why its toString method gives [object Object]. Perhaps what you are looking for is in obj.contents?

Answer from spelufo on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ nodejs โ€บ met_buffer_tostring.asp
Node.js buffer toString() Method
The toString() method returns the buffer object according to the specified encoding.
๐ŸŒ
Node.js
nodejs.org โ€บ api โ€บ buffer.html
Buffer | Node.js v26.10.0 Documentation
Returns a new ReadableStream that allows the content of the Blob to be read as a stream of UTF-8 decoded strings. It is equivalent to piping blob.stream() through a TextDecoderStream set up with UTF-8. ... The content-type of the Blob. Once a <Blob> object is created, it can be sent via MessagePort ...
๐ŸŒ
Adeva
adevait.com โ€บ nodejs โ€บ convert-node-js-buffer-to-string
How to Convert Node.js Buffer to String | Toptalยฎ
May 26, 2026 - In a nutshell, itโ€™s easy to convert a Buffer object to a string using the toString() method. Youโ€™ll usually want the default UTF-8 encoding, but itโ€™s possible to indicate a different encoding if needed.
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ JavaScript โ€บ Reference โ€บ Global_Objects โ€บ ArrayBuffer
ArrayBuffer - JavaScript - MDN Web Docs
You cannot directly manipulate the contents of an ArrayBuffer; instead, you create one of the typed array objects or a DataView object which represents the buffer in a specific format, and use that to read and write the contents of the buffer. The ArrayBuffer() constructor creates a new ArrayBuffer of the given length in bytes. You can also get an array buffer from existing data, for example, from a Base64 string or from a local file.
๐ŸŒ
GitHub
github.com โ€บ nodejs โ€บ node โ€บ issues โ€บ 6075
Incorrect result for Buffer#toString ยท Issue #6075 ยท nodejs/node
April 6, 2016 - All the posts are grouped under same key, because #toString() returns same value for both the buffer object.
Author: nodejs
๐ŸŒ
Medium
medium.com โ€บ hackernoon โ€บ https-medium-com-amanhimself-converting-a-buffer-to-json-and-utf8-strings-in-nodejs-2150b1e3de57
Converting a Buffer to JSON and Utf8 Strings in Nodejs | by Aman Mittal | HackerNoon.com | Medium
April 1, 2019 - The JSON specifies that the type of object being transformed is a Buffer, and its data. .toString() is not the only way to convert a buffer to a string.
Find elsewhere
๐ŸŒ
Bun
bun.com โ€บ guides โ€บ binary data โ€บ buffer to string
Convert a Buffer to a string | Bun Guides
The Buffer class provides a .toString() method that converts a Buffer to a string.
๐ŸŒ
Joshtronic
joshtronic.com โ€บ 2022 โ€บ 11 โ€บ 27 โ€บ convert-a-buffer-to-a-string-in-nodejs
Convert a buffer to a string in Node.js - Joshtronic
November 27, 2022 - The buffer is effectively just an array of integers that represent the data that it contains. To get a string back out of the buffer, simply use .toString():
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ node-js-buffer-explained
Node.js Buffer Explained
February 17, 2020 - Do notice that, Buffer API also provides a direct function toJSON() to convert a buffer into a JSON object. To examine the size of a buffer, we can use length method. ... Now let us convert buffer to a readable string, in our case, the utf-8 encoded.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ node-js-buffer-tostring-method
Node.js Buffer.toString() Method | GeeksforGeeks
October 13, 2021 - end: The last index of the buffer data up to which encoding has to be done. Its default value is Buffer.length. Return Value: It returns decoded string from buffer to string according to specified character encoding.
๐ŸŒ
Medium
medium.com โ€บ @ryan_forrester_ โ€บ buffer-to-string-in-javascript-how-to-guide-b24027575419
Buffer to String in JavaScript (How To Guide) | by ryan | Medium
January 7, 2025 - Only the first five bytes of the buffer are converted to a string, resulting in the output โ€œHelloโ€. When working with binary data from APIs, you often receive data as buffers.
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 48980375 โ€บ how-to-properly-turn-buffer-object-into-string
How to properly turn buffer object into string?
February 26, 2018 - The data that is received is a buffer, the object that comes out of it is suppose to look something like this : {name:"usersname"}. using .toString() on the buffer, gives me name=username (in string format obv)
๐ŸŒ
Medium
medium.com โ€บ @techsuneel99 โ€บ how-to-convert-a-buffer-to-json-in-node-js-4fa9ef98160
How to convert a Buffer to JSON in Node.js ? | by Suneel Kumar | Medium
December 31, 2023 - In this example, a Buffer is created ... object. Finally, the JSON representation is logged to the console using JSON.stringify. Note that this example creates a simple JSON structure with an array (data) to hold the buffer elements. Depending on your specific use case, you might want to structure the JSON differently or include additional information. Adjust the code accordingly based on your requirements. Buffer.values() returns an iterator ...
๐ŸŒ
Bureau of Economic Geology
beg.utexas.edu โ€บ lmod โ€บ agi.servlet โ€บ doc โ€บ detail โ€บ java โ€บ lang โ€บ StringBuffer.html
java.lang Class StringBuffer
Converts to a string representing the data in this string buffer. A new String object is allocated and initialized to contain the character sequence currently represented by this string buffer. This String is then returned.