Convert a file to byte array
Santhosh Kumar Jayaraman Updated date Dec 31, Step 3: Now we need to convert the byte array back again to the file content and display it to the user with download options.
For that I am using another method, ShowDocument, as below:. Next Recommended Reading. Net Core 6. Create A. Understanding Thread Starvation in. NET Core Applications. Nerd figure out why.. Unfortunately some of our below listed tools require Java plugin: Desktop recorder. Error Screen capture. Time Tracker. You have exceeded the maximum number of characters allowed for a comment without sign in. Either enter Content Or Record. Done Close.
Insert an Image. Positive Votes. Negative Votes. Delete Comment. Are you sure, you want to delete this comment? OK Cancel. Sign In. User Name Please enter user name. Password Password should have minimum 6 characters Please enter password. Remember Me. Forgot Password? Improve this question. Community Bot 1 1 1 silver badge. Lempkin Lempkin 1, 2 2 gold badges 18 18 silver badges 44 44 bronze badges. I saw this one but it doesn't ends with a byte[] — Lempkin. Yes it is.
A string is a array of char, when char are bytes the string is a array of bytes — Alexis. Also readAsBinaryString is deprecated, i cannot use it anymore — Lempkin. The closest thing you can get to an array of bytes is an Uint8Array, which just happens to take an arraybuffer as an argument to its constructor. Yep that's what i did finally, thx : — Lempkin.
Show 1 more comment. Active Oldest Votes. Improve this answer. Santosh Ch Santosh Ch 1 1 silver badge 5 5 bronze badges.
Please take some time to properly indent your code. There is no sense in having 10, 15 empty columns on the left hand side! This too is not a perfect 'byte[]' can you explain? Add a comment. How about these functions - one where you can read it as text, another as a base64 byte string, and if you really want the readAsArrayBuffer array buffer output, I've included that, too: document.
0コメント