Is it possible to fetch local file in the react client side as in the similar format as it does in the node fs.readFileSync() method

Viewed 188

I am trying to fetch the local file path in the React client side as similar to the node file system method.

USING: -

await fetch(
 path.join("node_modules",
  "dictionary-en",
   "index")
)
.then(function (response) {
   response; //array Buffer
})

But it is returning response in Array Buffer [] && I am expecting <Buffer ..... /> as what is does in the node file system read File Sync

0 Answers
Related