Answered by:
FileOpenPicker question: How do I get a BLOB from a StorageFile?

Question
-
How can I get a BLOB object from a StorageFile that I've opened via the FileOpenPicker?
Other questions I could find seem outdated and mention a msWWA.createBlobFromRandomAccessStream method which doesn't seem to exist and the only file access example I could find creates a Blob URL via URL.createObjectURL and not an actual BLOB object.
Background info: I am trying to use zip.js to read a local zip file in Javascript.
Monday, March 19, 2012 4:19 AM
Answers
-
Hi,
You can refer to:
http://code.msdn.microsoft.com/windowsapps/Blob-Sample-0e35889e
This sample demonstrates how to work with FileOpenPicker and blob. Senario 5 introduces how to create blob from stream.
Allen Chen [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Edited by Allen Chen - MSFT Monday, March 19, 2012 9:49 AM
- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Monday, March 19, 2012 1:08 PM
- Marked as answer by Patrick Klug Thursday, March 22, 2012 12:29 AM
Monday, March 19, 2012 9:49 AM -
To spare anyone from searching through the sample the answer is to call
MSApp.createBlobFromRandomAccessStream(file.contentType, stream);
To get the opposite (a Stream from a BLOB) use this:
blob.msDetachStream();
- Marked as answer by Patrick Klug Friday, March 23, 2012 1:22 AM
- Edited by Patrick Klug Friday, March 23, 2012 1:24 AM
Friday, March 23, 2012 1:22 AM
All replies
-
Hi,
You can refer to:
http://code.msdn.microsoft.com/windowsapps/Blob-Sample-0e35889e
This sample demonstrates how to work with FileOpenPicker and blob. Senario 5 introduces how to create blob from stream.
Allen Chen [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Edited by Allen Chen - MSFT Monday, March 19, 2012 9:49 AM
- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Monday, March 19, 2012 1:08 PM
- Marked as answer by Patrick Klug Thursday, March 22, 2012 12:29 AM
Monday, March 19, 2012 9:49 AM -
To spare anyone from searching through the sample the answer is to call
MSApp.createBlobFromRandomAccessStream(file.contentType, stream);
To get the opposite (a Stream from a BLOB) use this:
blob.msDetachStream();
- Marked as answer by Patrick Klug Friday, March 23, 2012 1:22 AM
- Edited by Patrick Klug Friday, March 23, 2012 1:24 AM
Friday, March 23, 2012 1:22 AM