been trying to convert a file to a stream in the browser. Am working on some ionic2 project and i don't seem to find a way to do so. Ionic's file plugin can return either a binary string or an array buffer and i don't seem to know how to convert those to a stream either. Any help ?
Asked
Active
Viewed 1,822 times
0
-
I suppose you can use the `input` with `type=file` to allow user to upload a file. Any particular reason for not doing so? – Nisarg Shah May 20 '17 at 03:38
-
Actually i need to get metadata for a bunch of music files and the plugin am using requires the files stream – marvin ralph May 20 '17 at 03:42
-
You could get the metadata on an input with `file=type` as such: `document.getElementById('myFile').files[0]` – Nisarg Shah May 20 '17 at 03:51
-
try something like `this.file.readAsArrayBuffer(filePath, fileName) .then(val => { var blob = new Blob([new Uint8Array(val)], { type: mediaType });})` – Pablo Albaladejo May 20 '17 at 09:32
-
@Pablo actually I need to convert to a file stream – marvin ralph May 21 '17 at 09:28