Wednesday, 9 January 2019

Why does my json file keeps updating after writing it to disk?

All I am doing is running a config object through a function that uses FakerJS to build a ‘model’ object.All the code is synchronous, zero API calls and uses caching to speed things up but when I try to write the return value to a json file using fs and take a look at the file, the values for every field just keep updating (to a valid value as if the function just kept executing) and will continue to do so until I ‘npm start’ again. has anyone heard of anything like this?Basically the flow isconst opts = createSchemaOpts(config) // opts objectconst schemas = CreateSchemas(config, opts) // schema arrayconst mocks = createMocks(schemas) //mocks objectIterate mocks and write each to json file.Debugger and console.log both show the expected results so it seems to do this in the actual json file itself even after I kill the node process.here is a short clip to see what I’m talking about

Submitted January 10, 2019 at 02:16AM by T_O_beats

No comments:

Post a Comment