How i can manually convert to buffer?
See original GitHub issueIf i pass buffer: true
, I have no problem, it works.
The problem is that i don’t want all requests to be a buffer, so i removed the property and instead i’m doing Buffer.from(ctx.request.body)
but i’m getting a different buffer instead.
Any idea why?
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
How to convert a String to Buffer and vice versa in Node.js
To convert a Buffer to a String, you can use the toString() in the Buffer object. // buffer const str = "Hey. this...
Read more >Convert Node.js Buffer to String: An Easy-To-Follow Guide
Learn how to convert Node.js Buffer to string by using this simple guide with straightforward instructions.
Read more >Node.js: How to read a stream into a buffer? - Stack Overflow
You can convert your readable stream to a buffer and integrate it in your code in ... Its easy to do manually, or...
Read more >How to Use Buffers in Node.js
The Buffer class in Node.js is designed to handle raw binary data. Each buffer corresponds to some raw memory allocated outside V8.
Read more >AVSpeechSynthesizer buffer conversion, write format bug?
When I apply it to the speech buffer, I get back noise. When I attempt to manually convert format and to stereo with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can’t send a normal array over the wire 😛 An array is not a data structure outside of JS.
The Uint8Array is a representation of the binary data (byte by byte). It’s a buffer basically.
I’ll try to create a test case tomorrow but now i have to run! 🎉
But it should be:
empty
-> no encoding, and works with buffer.utf8
-> utf8 etc -> etcSo basically i need the case where
empty
value or no value, doesn’t add any encoding.And right now, the
empty
case will trigger the default encoding ofutf8
.So… removing the default value will break compatibility since people usually don’t specify
utf8
manually, they omit the value and make use of the default, which isutf8
. This people will now get a buffer instead of the expectedutf8
string. Thats why i claim that it will break compatibility but i may be wrong