0

How can I read only a certain number of bytes from a file in Ionic?

I am using the Native File plugin but it doesn't seem to handle that. I tried all the file reading methods :

  • readAsText(path, file)
  • readAsDataURL(path, file)
  • readAsBinaryString(path, file)
  • readAsArrayBuffer(path, file)

They all work fine, but I don't want to have to read the whole file and then extract the part I need, that would defeat the purpose.

Sébastien
  • 11,860
  • 11
  • 58
  • 78
  • even though its not ionic, you could try to use javascript: https://stackoverflow.com/questions/14842214/html5-filereader-how-to-only-read-the-first-n-characters-of-a-file or maybe https://stackoverflow.com/questions/34544230/read-part-of-remote-file – ewizard Nov 29 '17 at 22:53
  • As I understand [FileReader](https://developer.mozilla.org/en-US/docs/Web/API/FileReader) only works with an `` element or with drag and drop. I don't know how to use it with the Native File plugin. – Sébastien Nov 30 '17 at 00:07

0 Answers0