by jamiebuilds

jamiebuilds / write-files-atomic

Write many files atomically

127 Stars 4 Forks Last release: Not found MIT License 6 Commits 1 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


Write many files atomically

  • Creates temporary files with file contents
  • Moves them all at once using
  • Automatically cleans up after itself
  • Optimized to be as fast as possible
  • Doesn't break file watchers
  • Doesn't swallow errors
  • Includes Flow types


yarn add write-files-atomic


const writeFilesAtomic = require('write-files-atomic');

await writeFilesAtomic([ { filePath: './foo.txt', fileContents: '...foo...' }, { filePath: './bar.txt', fileContents: '...bar...' }, { filePath: './baz.txt', fileContents: '...baz...' }, ]);


type Files = Array;

declare function writeFilesAtomic(files: Files): Promise;

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.