9 questions
-1
votes
1
answer
419
views
Why does using toString('binary') on a Node.js buffer give strange characters?
I have something similar to the following code:
const fs = require('fs');
const imageBuffer = fs.readFileSync('path/to/image.jpg');
const binary = imageBuffer.toString('binary');
console.log(binary)...
4
votes
1
answer
3k
views
Python equivalent of Node.js Buffer.from('string', 'base64')
I'm trying to implement authorization based on a hash-based message authentication code (HMAC)-encrypted authorization header. To do so I need to use the authorization header to verify the ...
1
vote
0
answers
355
views
Cannot parse a PDF stream using pdf-parse on Azure pipelines (Nodejs)
We have an Nodejs api endpoint that creates a pdf stream using the html-pdf and streams it through the response. This is working as expected, we can download the pdf through the browser.
I am trying ...
1
vote
0
answers
3k
views
Creating an Image File using node.js buffer from input text
I have a requirement in which I need to convert an input text to a png/jpeg file and then convert to base64 string and send as an input to an API.
I cannot use node.js fs module since I cannot ...
0
votes
1
answer
2k
views
Write array to Buffer on a specific offset in Node.js
I wish to add an array to a buffer at a specific offset. This does not work:
let buffer = Buffer.alloc(65);
buffer.writeUInt8(0x91, 0);
buffer.write([127, 0, 0, 1 ], 1);
buffer.write("admin", 5);
...
2
votes
1
answer
2k
views
How to send the buffer correctly in node.js via response.write?
I am trying to send out the binary content from a node.js server. To do this, I allocate a buffer and fill up the buffer with my content, and call response.write() on it. Once it returns, I reuse the ...
1
vote
2
answers
2k
views
Node.js using deferent data types in bytes array
I need to create a byte array with deferent data types in it, For example: i will have data that will contain Byte (0-100), Byte(0-10), Two bytes(-30-+100), Bool(0/1), Byte, Two Bytes(0-300).
The ...
1
vote
0
answers
227
views
Raspberry pi USB serial transmission
I have problem with to the raspberry's usb serial tx direction.
I use npm's serialport software with node.js.
If I plug the usb cable (max232) with windows to serialmonitor, I can see the hex code (...
3
votes
1
answer
6k
views
Canonical way to remove multiple bytes from buffer
Say I have a simple Buffer in Node.js like so:
const bytes = Buffer.from('abcdefg');
this buffer instance has slice and concat as methods, but I am really not sure how to use these to basically ...