|
4 | 4 | File System API
|
5 | 5 | ===============
|
6 | 6 |
|
7 |
| -File operations in Emscripten are provided by the `FS <https://github.com/emscripten-core/emscripten/blob/master/src/library_fs.js>`_ library. It is used internally for all of Emscripten's **libc** and **libcxx** file I/O. |
| 7 | +File operations in Emscripten are provided by the `FS <https://github.com/emscripten-core/emscripten/blob/main/src/library_fs.js>`_ library. It is used internally for all of Emscripten's **libc** and **libcxx** file I/O. |
8 | 8 |
|
9 | 9 | .. note:: The API is *inspired* by the Linux/POSIX `File System API <http://linux.die.net/man/2/>`_, with each presenting a very similar interface.
|
10 | 10 |
|
11 | 11 | The underlying behaviour is also similar, except where differences between the
|
12 | 12 | native and browser environments make this unreasonable. For example, user and
|
13 | 13 | group permissions are defined but ignored in :js:func:`FS.open`.
|
14 | 14 |
|
15 |
| -Emscripten predominantly compiles code that uses synchronous file I/O, so the majority of the ``FS`` member functions offer a synchronous interface (with errors being reported by raising exceptions of type `FS.ErrnoError <https://github.com/emscripten-core/emscripten/blob/master/system/lib/libc/musl/arch/emscripten/bits/errno.h>`_). |
| 15 | +Emscripten predominantly compiles code that uses synchronous file I/O, so the majority of the ``FS`` member functions offer a synchronous interface (with errors being reported by raising exceptions of type `FS.ErrnoError <https://github.com/emscripten-core/emscripten/blob/main/system/lib/libc/musl/arch/emscripten/bits/errno.h>`_). |
16 | 16 |
|
17 | 17 | File data in Emscripten is partitioned by mounted file systems. Several file systems are provided. An instance of :ref:`MEMFS <filesystem-api-memfs>` is mounted to ``/`` by default. The subdirectories `/home/web_user` and `/tmp` are also created automatically, in addition to several other special devices and streams (e.g. `/dev/null`, `/dev/random`, `/dev/stdin`, `/proc/self/fd`); see `FS.staticInit()` in the FS library for full details. Instances of :ref:`NODEFS <filesystem-api-nodefs>` and :ref:`IDBFS <filesystem-api-idbfs>` can be mounted to other directories if your application needs to :ref:`persist data <filesystem-api-persist-data>`.
|
18 | 18 |
|
|
62 | 62 |
|
63 | 63 | This file system lets a program in *node* map directories (via a mount operation) on the host filesystem to directories in Emscripten's virtual filesystem. It uses node's synchronous `FS API <http://nodejs.org/api/fs.html>`_ to immediately persist any data written to the Emscripten file system to your local disk.
|
64 | 64 |
|
65 |
| -See `this test <https://github.com/emscripten-core/emscripten/blob/master/tests/fs/test_nodefs_rw.c>`_ for an example. |
| 65 | +See `this test <https://github.com/emscripten-core/emscripten/blob/main/tests/fs/test_nodefs_rw.c>`_ for an example. |
66 | 66 |
|
67 | 67 | .. _filesystem-api-idbfs:
|
68 | 68 |
|
@@ -219,7 +219,7 @@ File system API
|
219 | 219 | });
|
220 | 220 | }
|
221 | 221 |
|
222 |
| - A real example of this functionality can be seen in `test_idbfs_sync.c <https://github.com/emscripten-core/emscripten/blob/master/tests/fs/test_idbfs_sync.c>`_. |
| 222 | + A real example of this functionality can be seen in `test_idbfs_sync.c <https://github.com/emscripten-core/emscripten/blob/main/tests/fs/test_idbfs_sync.c>`_. |
223 | 223 |
|
224 | 224 | :param bool populate: ``true`` to initialize Emscripten's file system data with the data from the file system's persistent source, and ``false`` to save Emscripten`s file system data to the file system's persistent source.
|
225 | 225 | :param callback: A notification callback function that is invoked on completion of the synchronization. If an error occurred, it will be provided as a parameter to this function.
|
|
0 commit comments