Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 230058

Read binary file located in project directory using @ionic/react-hooks/filesystem

$
0
0

Hi guys. I want to read a docx file inside my src in runtime. this is my function:

const loadTemplate = async (readFile) => {
  try {
    let contents = await readFile({
      path: "./template.docx",
      directory: FilesystemDirectory.Data
      //encoding: FilesystemEncoding.UTF8
    });
    console.log(contents);
    return contents;
  } catch (e) {
    throw e;
  }
};

readFile function is destructed from useFilesystem() destructed from ‘@ionic/react-hooks/filesystem’.
it says Error: File does not exist.
How can I open binary file located in my project?


Viewing all articles
Browse latest Browse all 230058

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>