You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
The file is initially namedfilename + "." + murmurhex(__filename, process.pid, ++invocations).Note thatrequire('worker_threads').threadId is used in addition toprocess.pid if running inside of a worker thread.If writeFile completes successfully then, if passed thechown option it will changethe ownership of the file. Finally it renames the file back to the filename you specified. Ifit encounters errors at any of these steps it will attempt to unlink the temporary file and thenpass the error back to the caller.If multiple writes are concurrently issued to the same file, the write operations are put into a queue and serialized in the order they were called, using Promises. Writes to different files are still executed in parallel.
If provided, thechown option requires bothuid andgid properties or elseyou'll get an error. Ifchown is not specified it will default to usingthe owner of the previous file. To prevent chown from being ran you canalso passfalse, in which case the file will be created with the current user's credentials.
Ifmode is not specified, it will default to using the permissions froman existing file, if any. Expicitly setting this tofalse remove this default, resultingin a file created with the system default permissions.
If options is a String, it's assumed to be theencoding option. Theencoding option is ignored ifdata is a buffer. It defaults to 'utf8'.
If thefsync option isfalse, writeFile will skip the final fsync call.
If thetmpfileCreated option is specified it will be called with the name of the tmpfile when created.