0

Is anyone able to explain, why is this React face detection example able to write to filesystem?

https://codesandbox.io/s/opencv-js-face-detection-i1i3u?file=/src/App.jsx:515-516

using

https://github.com/TechStark/opencv-js

Script file cvDataFile.js calls an OpenCV method, that writes a file on filesystem cv.FS_createDataFile(...).

As far as I know, apps runing in browser are not able to do that, or are they?

I'm trying to create something very similar in Angular and failing on this exact line with nothing more in console.log than FS error. So before digging deeper into my bug, why is that code able to do that?

Jake_3H
  • 372
  • 4
  • 14
  • 1
    It's not actually creating a file, but wrapping IndexedDB as something that implements the interface. Probably something along the lines of https://emscripten.org/docs/api_reference/Filesystem-API.html#filesystem-api-idbfs – dave Dec 14 '22 at 00:12
  • Is that a react built-in feature? Since I cannot see any such dependency or anything – Jake_3H Dec 14 '22 at 00:20

0 Answers0