Writing to .data using Node's fs


#1

Hi all

I’ve been trying to write a file in Gomix to store a value that is POSTed to be retrieved by an IoT device later. Attempting to write to/read from the .data directory consistently fails with ENOENT errors:

{ Error: ENOENT: no such file or directory, open '.data/message.txt'
    at Error (native)
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '.data/message.txt' }

but attempting to read/write/delete without .data appears to work (although the file doesn’t show in the files list so I’m not sure where it goes).

Is there some magic going on to deal with file handling to do this invisibly, whereas with npm modules (like in the SQLite example) you have to explicitly add it?


#2

It looks like we’re not creating the .data directory for you right now. We’ll fix that, but you should be able to get past it by creating it yourself.