Convert objects into directory structures and back again
Convert JSON objects into directory structures on the file system, and back again. This package is primarily useful for writing tests.
npm install --save-dev fixturify
var fixturify = require'fixturify'fsmkdirSync'testdir'var obj ='foo.txt': 'foo.txt contents''subdir':'bar.txt': 'bar.txt contents'fixturifywriteSync'testdir' obj // write it to diskfixturifyreadSync'testdir' // => deep-equals obj
File contents are decoded and encoded with UTF-8.
fixture.readSync follows symlinks. It throws an error if it encounters a
To keep the API simple, node-fixturify has the following limitations:
Reading or setting file stats (last-modified time, permissions, etc.) is not supported.
Creating symlinks is not supported.
Special files like FIFOs, sockets, or devices are not supported.
File contents are automatically encoded/decoded into strings. Binary files are not supported.