natevw / fatfs

Standalone FAT16/FAT32 filesystem implementation in JavaScript
47 stars 13 forks source link

Sync set of functions #26

Closed RossComputerGuy closed 7 years ago

RossComputerGuy commented 7 years ago

When will there be the sync set of functions? I'm also wondering why there aren't the sync functions right now?

natevw commented 7 years ago

There are no sync functions right now because the underlying I/O is async, and that was async because on the Tessel v1 platform this was written for, the SPI driver used to talk with the SD Card was also async.

This was both by design, and out of necessity: once one part of the JS codebase is async, everything on top needs to be too. Since Tessel's I/O was async at the JS level, anything built on it needed to be async.

I don't plan on ever adding sync versions to this library. It would require an almost completely new codebase. Since async I/O is a major focus of node.js it doesn't make a lot of sense to me to invest in a second node.js FATFS driver, based around blocking I/O like that.

natevw commented 7 years ago

I've added a summary of this to the docs for future reference. Thanks for you interest, and feel free to re-open this issue if you feel I haven't adequately answered your question!