web API file upload/download

Lockheed800

New member
Joined
Mar 9, 2023
Messages
1
Programming Experience
Beginner
Hi,
I would like to know about advantages/disadvantages between binary vs. byte file upload.
Is there any recommendation, and why?

Thank you
 
Always choose the format that uses the least bandwidth.
 
From what I understand people commonly mean when they use the phrases "binary" (e.g. when you tell an old school ftp client to upload BIN rather than ASC) and "byte" (e.g. when you tell a microsoft file stream to WriteBytes), they're the same thing

Give a code example of what you mean by each and we'll tell you any salient differences
 
We should get confirmation from the OP, but I suspect that what they are calling "binary" is when they are using a stream, while what they are calling "byte" is when they are using a byte array. In the end, it still goes on the wire (or the ether) the same way -- it's binary any which way.

I am hoping that what OP means by "byte" IS NOT that they convert bytes to hex codes and then send the hex digits, or that they convert the bytes to base64 and then send the characters. That would be a complete waste of bandwidth.
 
Oh, I always use this on my byte arrays before I upload them:

C#:
public static string ByteArrayToBinStr(byte[] ba)
{
    string binary=""
    for each (byte b in ba)
        binary+=Convert.Tostring(b, 2).PadLetf('0', 8)
    return binary;
}

Don't worry, I use zipstreams to compress it😂


--

Please note, this post is a complete joke, totally tongue in cheek and the code is deliberately crippled because you absolutely should not, in any way, ever do this
 
You forgot to convert the returned string to UTF7... :)
 
Back
Top Bottom