gemini-testing / looks-same

Node.js library for comparing images
MIT License
660 stars 55 forks source link

Error when diff path contains folders that does not exist #68

Open alonseg opened 4 years ago

alonseg commented 4 years ago

'looks-same' saves the diff file using fs.createWriteStream(), passing that path as a parameter. Now, fs.createWriteStream() fails when the directory the path is pointing to doesn't exist - and that's the problem.

the shown error:

ENOENT: no such file or directory, open '...'

possible solutions:

  1. using fsExtra.outputFile() which creates any missing directories. (best IMO)
  2. Implementing the recursive mkdir ourselves

initially found here