Data Application Octet Stream

Posted on

I'm trying to send a HTTP POST to a device on my network. I want to send four specific bytes of data to the device unfortunately I only seem to be able to send strings to the device. Is there anyway to send raw binary using javascript?

Data Application Octet Stream Base64

Here's the script I'm using to do the POST, it currently doesn't run unless I put a string in the data field. Any ideas?

Jan 04, 2019  REAL FOOTBALL FOOTBALL STRIKE. BIGGEST GAMESHOW FAILS EVER! Family Feud, Match Game, Celebrity Name Game! Sepak Welcome to Agame.com, your zone to play free online games. Stocked each day with new free games, including action games, adventure games, board & card games, multiplayer games, puzzle games, racing games, skill games, sports games, and more addicting games.

Topics Clear All There are no Topics that match this search. Topic Categories Clear All There are no Topic Categories that match this search. Dataset Type Clear All There are no Dataset Type that match this search.

Data Application Octet Stream
  • Aug 27, 2014 - I have blob data in javascript and I need to save the data local. I tried to the approach which I wrote in subject but it looks like doesn't work. Then generate blob data from base64 string.
  • Handle content types in Azure Logic Apps.; 5 minutes to read Contributors. In this article. Various content types can flow through a logic app, for example, JSON, XML, flat files, and binary data.
user2984509user2984509

4 Answers

By default, jQuery serializes the data (passed in data property) - and it means 0xFD008001number gets passed to the server as '4244668417' string (10 bytes, not 4), that's why the server treats it not as expected.

It's necessary to prevent such behaviour by setting $.ajax property processData to false:

By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type 'application/x-www-form-urlencoded'. If you want to send a DOMDocument, or other non-processed data, set this option to false.

.. but that's only part of the whole story: XMLHttpRequest.send implementation has its own restrictions. That's why your best bet, I suppose, is to make your own serializer using TypedArrays:

Stream

Or without using jQuery at all:

raina77owraina77ow

You can send binary data via ajax with xhr2, you can send the data as a typed array or a blob.

MusaMusa

You could use atob() and btoa():

This converts your binary data into a base64 string that can be sent as text.

Sohail SiSohail Si

Application Octet Stream Files

You can convert your data with type of ArrayBuffer to a ArrayBufferView like this:

With this you wont get a warning in the console when sending fileContent.

Data Application Octet Stream
JonnyJonny

Not the answer you're looking for? Browse other questions tagged javascriptajaxbinaryhex or ask your own question.