Utilize Uint8Array within a JavaScript ArrayBuffer

After generating a javascript ArrayBuffer from a FileReader ReadAsArrayBuffer method on a jpeg file, I am attempting to access the UInt32 array of the buffer and send it to a WCF service for insertion into a server database.

I came across an example on Stack Overflow (byte array method) where a UInt32 array is converted to a byte array, which seems like it would be suitable for my needs.

However, I'm struggling to access the [[Uint8Array]] of my arrayBuffer variable in order to send it to the WCF service. I have attempted various methods such as:

   var arrayBuffer = reader.result[[Uint8Array]];//nope
     var arrayBuffer = reader.result[Uint8Array];//nope
     var arrayBuffer = reader.result.Uint8Array;//nope
     var arrayBuffer = reader.result[1];//nope

If anyone has any ideas or suggestions on how to properly access the [[Uint8Array]], please share. Whenever I send the entire ArrayBuffer to the WCF Service, I receive a 0 byte array, making it unreadable.

Thank you,

Pete

https://i.sstatic.net/DoGMs.jpg

Answer №1

The properties mentioned are not inherent to the ArrayBuffer object. They are added by the Dev Tools window for displaying the ArrayBuffer contents.

In order to create the TypedArray of your choice, you must use the appropriate constructor syntax

new TypedArray(buffer [, byteOffset [, length]]);

Therefore, if you want to create a Uint8Array in your case, you should execute:

var uint8View = new Uint8Array(arrayBuffer);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

React-file-viewer shrinks any document to a compact size

I have been searching extensively for information on how to adjust file sizing in react-file-viewer without any success. My objective is to utilize the react-file-viewer to allow users to click on a filename hyperlink and open the file (be it an image, do ...

Unable to reach socket.io.js on Raspberry Pi using Lighttpd [Node.JS & Socket.IO]

I just started learning about Node.JS and Socket.IO yesterday. I've been attempting to set up Node.JS and Socket.IO on my Raspberry Pi, but I can't seem to get it working. I'm unable to access <myip>:1337/socket.io/socket.io.js. I fol ...

Is there a way to retrieve the value from an input box?

<td class="stockQuantity"> <input class="form-control" id="Cart1" name="qty_req" required="required" type="text" value=""><br> <button type="button" o ...

"Learn how to use pure JavaScript to show the output of a PHP file on a webpage

I created a basic PHP file named hello.php that shows a 'hello world' message as follows: <?php echo "Hello world!"; ?> Now, I am looking to store this message in a JavaScript variable. How can I achieve this? <script type="tex ...

How to disable click event binding in Angular2 after it has been clicked once

Within my application, there is a button that has a click event attached to it: <button class="btn btn-default" (click)="doSomething()"> I am wondering if there is a way to remove the (click) event from the button within the doSomething method so t ...

Tips for pulling information from two different services using an identification number and showcasing the data

Looking for a way to select data in AngularJS (JavaScript) similar to PHP's SELECT "message" FROM "users" WHERE id = $id? Here is my current setup: app.service("users", function() { this.userList = [ { userId: 1, u ...

Is it possible for me to identify the modifications made to the data view within Spotfire Mods?

After successfully implementing monitoring for changes in the dataview and mod properties in my D3 network chart mod on Spotfire, I found that everything is working really well. The simulation running in the D3 network chart only needs to restart when the ...

Helping JavaScript determine my current location on the website

One issue I am facing is with a single template file that renders pages that may look similar but have slightly different behaviors. The header and text boxes are filled by the template language, while the canvas content distinguishes the pages. Different ...

Developing a user authentication system with TowerJS

As a front-end designer/developer with limited MVC experience, I am looking to create a login form using TowerJS. Following the documentation, my app includes a model named "User": class App.User extends Tower.Model @field "email", type: "String" @fie ...

When sending a single apostrophe as a parameter in an AJAX post request, it will result in an error

JavaScript Code: var name = jQuery("#name1").val(); jQuery.ajax({ url: siteUrl + 'search/ind', type: 'POST', data: { name: name, }, success: function(data) { jQuery('#input').val(''); } } ...

"What are the reasons for encountering a '404 not found' error with Django when accessing a

I recently developed a Django script that utilizes a Python parser to navigate the web. I have set up AJAX to send requests to this Django script, but I am encountering a 404 error for the URL when the Ajax runs. Can you help me understand why this is occu ...

Transmit a PDF byte array from JavaScript to PHP using Ajax, then utilize the PHP file to send an email

I am facing a particular issue. Currently, I am utilizing the pdf-lib library for JavaScript to generate a PDF. The last step involves creating a uint8array: const pdfBytes = await pdfDoc.save() My goal is to transmit these pdfbytes via AJAX to a PHP fi ...

create undirected lists using an array

I am trying to convert an array of sentences into unordered HTML lists, with each list item containing a word from the sentence. For example: [I play piano the can'] t <ul> <li id = number</li> <li>I</li> <li>play< ...

The image being displayed is significantly wider than the corresponding HTML element

I'm attempting to display this webpage in PNG format using npm's wkhtmltox: <!doctype html> <html> <head> <meta charset="utf-8"> <style> html, body { padding: 0; width: 340px; } ...

JavaScript script to modify the parameter 'top' upon clicking

Here is the pen I've made. HTML <div class = 'cc'> <div class = 'bb'><div class = 'aa'> Some word </div></div> </div> CSS .cc { width: 100%; min-height: 90px; margin: 0; ...

Exploring Android phone contacts using PhoneGap and Sencha Touch

Can anyone assist me in retrieving a list of all contacts from my phone using the code below? var App = new Ext.Application({ name: 'SmsthingyApp', useLoadMask: true, launch: function () { Ext.data.ProxyMgr.registerType("contactstorage", ...

Ways to convert an object with values into an array containing those values

To process the JSON data and convert it into an array with the same values for insertion into my PostgreSQL database using pool.query(message, values), where values should be an array if multiple are present. Currently, my object structure is as follows: { ...

Encountered Axios GET error, [nodemon] server crashed - currently monitoring for any file modifications before relaunching (using express js, mysql, and react

Initially, my backend was running smoothly until I encountered an issue with axios not being able to retrieve GET data from the backend. In an attempt to resolve this, I changed the port to 8000 in the index.js file, but this caused the backend server to c ...

An assessment consisting of three parts, with the initial section required to match the size of the browser window using jQuery and Javascript

UPDATE: The issue was resolved by adding the Doctype at the top of the page - "<!DOCTYPE html>" (no spaces between tags < , > and other characters) I am experimenting with a webpage that contains four sections. The first section should take up ...

Determine the position of an object within an array using jQuery or JavaScript

Here is an example of HTML code: <ul class="paginering"> <li><a href="javascript:void(0)">Previous</a></li> <li class="active"><a onclick="changeDisplay(this)" href="javascript:void(0)">1</a></li> & ...