Returns information about the given file or directory.
The method is similar to the stat
method except it doesn't follow symlinks.
When given a path that is a symlink it returns the stat of the symlink and not its target.
Asynchronously reads the entire contents of a file.
Resolves with the contents of the file as an Uint8Array
or a string
if the encoding is set to utf8
.
Optional
options: EncodingOptionsAsynchronously writes data to a file, replacing the file if it already exists.
Data can be a string
or an Uint8Array
.
The encoding option is ignored if data is an Uint8Array
.
Optional
options: WriteOptionsGenerated using TypeDoc
An interface that abstracts file system operations.
You need to pass a file system client into Git commands that do anything that involves files (which is most things in Git).
In Node.js, you can pass the builtin
fs/promises
module. In the browser it's more involved because there's no standardfs
module. But you can use any module that implements enough of thefs
API.Node.js
If you're only using the library in Node.js, you can just use the native
fs/promises
module:Browser
For testing purposes, the library includes in-memory file system implementations which can be used on both Node.js and browser environments. For persistent production use, you will have to use 3rd party clients/build-in clients in this package or your own implementation.