Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adafruit/atom-fsync-on-save
When saving to a CIRCUITPY drive, make sure the file is completely written out immediately.
https://github.com/adafruit/atom-fsync-on-save
atom-package circuitpython
Last synced: 6 days ago
JSON representation
When saving to a CIRCUITPY drive, make sure the file is completely written out immediately.
- Host: GitHub
- URL: https://github.com/adafruit/atom-fsync-on-save
- Owner: adafruit
- License: mit
- Created: 2017-12-01T16:57:11.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-27T02:27:24.000Z (almost 6 years ago)
- Last Synced: 2024-12-16T17:51:49.874Z (6 days ago)
- Topics: atom-package, circuitpython
- Language: JavaScript
- Size: 10.7 KB
- Stars: 2
- Watchers: 11
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fsync-on-save
When Atom saves a file, sometimes you need to flush all the
data to the storage device immediately. For instance, you might want to
make sure data is written to a persistent storage medium promptly, or
a file might be on on a removable drive that may be unplugged without
notice.This simple package does an `fsync()` or equivalent to write all the
data immediately. The `node.js` function `fs.fsyncSync()` is called
after the file is written.The original motivation for this package was to make Atom be a safe
editor for use with [Adafruit Industries CircuitPython](https://www.adafruit.com/circuitpython).
CircuitPython will automatically reload and restart when a file is
written to the `CIRCUITPY` drive. Several operating systems do not
write all data and metadata to USB drives immediately. This
delayed-write behavior can cause auto-reload to read an incompletely
written version of the updated file (such as `main.py` or `code.py`)
when CircuitPython restarts. It can also cause the `CIRCUITPY`
filesystem to become corrupted if the board is unplugged or reset
before the file is completely written.As of this writing, this delayed-write behavior is noticeable on
Windows and Linux, but not on MacOS. Note that Linux may still write
additional metata to `CIRCUITPY` a minute or so later after saving the
file, causing an auto-reload. That's a different problem which this
package cannot address.