All Projects → jamiebuilds → Write Files Atomic

jamiebuilds / Write Files Atomic

Licence: mit
Write many files atomically

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Write Files Atomic

go-storage
A vendor-neutral storage library for Golang: Write once, run on every storage service.
Stars: ✭ 387 (+207.14%)
Mutual labels:  files, fs
matched
Glob matching with support for multiple patterns and negation. Use `~` in cwd to find files in user home, or `@` for global npm modules.
Stars: ✭ 25 (-80.16%)
Mutual labels:  files, fs
Steno
Specialized fast async file writer
Stars: ✭ 236 (+87.3%)
Mutual labels:  fs, atomic
Chonky
😸 A File Browser component for React.
Stars: ✭ 313 (+148.41%)
Mutual labels:  files, fs
bash-glob
Bash-powered globbing for node.js. Alternative to node-glob. Does not work on Windows 9 and lower.
Stars: ✭ 13 (-89.68%)
Mutual labels:  files, fs
glob-fs
file globbing for node.js. speedy and powerful alternative to node-glob. This library is experimental and does not work on windows!
Stars: ✭ 54 (-57.14%)
Mutual labels:  files, fs
Go Storage
An application-oriented unified storage layer for Golang.
Stars: ✭ 87 (-30.95%)
Mutual labels:  files, fs
copy
Copy files using glob patterns. Sync, async, promise or streams. (node.js utility)
Stars: ✭ 84 (-33.33%)
Mutual labels:  files, fs
Python Atomicwrites
Powerful Python library for atomic file writes.
Stars: ✭ 253 (+100.79%)
Mutual labels:  files, atomic
Temperment
Get a random temporary file or directory path that will delete itself
Stars: ✭ 21 (-83.33%)
Mutual labels:  files, fs
Chemfiles
Library for reading and writing chemistry files
Stars: ✭ 95 (-24.6%)
Mutual labels:  files
Quark
Quark.js is a microscopic atomic CSS polyfill in JS just 140 bytes
Stars: ✭ 97 (-23.02%)
Mutual labels:  atomic
Zetalongpaths
A .NET library to access files and directories with more than 260 characters length.
Stars: ✭ 113 (-10.32%)
Mutual labels:  files
Litfs
A FUSE file system in Go extended with persistent file storage
Stars: ✭ 116 (-7.94%)
Mutual labels:  fs
Gemma
A lightweight CSS library.
Stars: ✭ 94 (-25.4%)
Mutual labels:  atomic
Node Klaw Sync
Node.js recursive synchronous fast file system walker
Stars: ✭ 112 (-11.11%)
Mutual labels:  fs
S3fs
S3 FileSystem (fs.FS) implementation
Stars: ✭ 93 (-26.19%)
Mutual labels:  fs
Ring Buffer
simple C++11 ring buffer implementation, allocated and evaluated at compile time
Stars: ✭ 80 (-36.51%)
Mutual labels:  atomic
Filite
A simple, light and standalone pastebin, URL shortener and file-sharing service
Stars: ✭ 125 (-0.79%)
Mutual labels:  files
Flint
Fast and configurable filesystem (file and directory names) linter
Stars: ✭ 115 (-8.73%)
Mutual labels:  fs

write-files-atomic

Write many files atomically

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

Install

yarn add write-files-atomic

Usage

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

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

API

type Files = Array<{
  filePath: string,
  fileContents: string | Buffer,
  encoding?: string, // default 'utf8'
  mode?: number,
  chown?: { uid: number, gid: number }, // default `fs.stat` of existing file
}>;

declare function writeFilesAtomic(files: Files): Promise<void>;
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].