I have the report download api working in node.js but I need it working client side using javascript. I appears that I need the function buffer() in node.js to create the properly formatted byte array. If you have a javascript example or can point me to how to convert to a byte array in javascript, that would be so helpful.
Solved! Go to Solution.
01-30-2024 08:52 AM
To enable the report download API on the client-side with JavaScript, you can replicate the Node.js buffer() function using the ArrayBuffer in JavaScript. Here's a simple example:
// Node.js buffer function
const nodeBuffer = Buffer.from('YourData', 'utf-8');
// Equivalent ArrayBuffer in JavaScript
const arrayBuffer = new TextEncoder().encode('YourData');
// Converting ArrayBuffer to byte array (Uint8Array)
const byteArray = new Uint8Array(arrayBuffer);
// Now you can use 'byteArray' for further processing
This example showcases how to create a byte array in JavaScript, similar to the buffer() function in Node.js. You can adapt this to your specific use case for handling the report download on the client side.
02-07-2024 05:16 AM
To enable the report download API on the client-side with JavaScript, you can replicate the Node.js buffer() function using the ArrayBuffer in JavaScript. Here's a simple example:
// Node.js buffer function
const nodeBuffer = Buffer.from('YourData', 'utf-8');
// Equivalent ArrayBuffer in JavaScript
const arrayBuffer = new TextEncoder().encode('YourData');
// Converting ArrayBuffer to byte array (Uint8Array)
const byteArray = new Uint8Array(arrayBuffer);
// Now you can use 'byteArray' for further processing
This example showcases how to create a byte array in JavaScript, similar to the buffer() function in Node.js. You can adapt this to your specific use case for handling the report download on the client side.
02-07-2024 05:16 AM
Thanks for the tip. That worked well! Do you have an example of the next step which is to hash the public key using the byte array of the secret key? What crypto call are you using to hash the byte array?
02-08-2024 07:51 AM - edited 02-08-2024 07:54 AM
Thanks for the tip its working well
03-08-2024 04:26 AM