File System - Deno documentation

Classes

c
Deno.FsFile

The Deno abstraction for reading and writing files.

Functions

f
Deno.chmod

Changes the permission of a specific file/directory of specified path. Ignores the process's umask.

f
Deno.chmodSync

Synchronously changes the permission of a specific file/directory of specified path. Ignores the process's umask.

f
Deno.chown

Change owner of a regular file or directory.

f
Deno.chownSync

Synchronously change owner of a regular file or directory.

f
Deno.copyFile

Copies the contents and permissions of one file to another specified path, by default creating a new file if needed, else overwriting. Fails if target path is a directory or is unwritable.

f
Deno.copyFileSync

Synchronously copies the contents and permissions of one file to another specified path, by default creating a new file if needed, else overwriting. Fails if target path is a directory or is unwritable.

f
Deno.create

Creates a file if none exists or truncates an existing file and resolves to an instance of Deno.FsFile.

f
Deno.createSync

Creates a file if none exists or truncates an existing file and returns an instance of Deno.FsFile.

f
Deno.fdatasync

Flushes any pending data operations of the given file stream to disk.

f
Deno.fdatasyncSync

Synchronously flushes any pending data operations of the given file stream to disk.

f
Deno.flock

Acquire an advisory file-system lock for the provided file.

f
Deno.flockSync

Acquire an advisory file-system lock synchronously for the provided file.

f
Deno.fsync

Flushes any pending data and metadata operations of the given file stream to disk.

f
Deno.fsyncSync

Synchronously flushes any pending data and metadata operations of the given file stream to disk.

f
Deno.funlock

Release an advisory file-system lock for the provided file.

f
Deno.funlockSync

Release an advisory file-system lock for the provided file synchronously.

f
Deno.linkSync

Synchronously creates newpath as a hard link to oldpath.

f
Deno.lstat

Resolves to a Deno.FileInfo for the specified path. If path is a symlink, information for the symlink will be returned instead of what it points to.

f
Deno.lstatSync

Synchronously returns a Deno.FileInfo for the specified path. If path is a symlink, information for the symlink will be returned instead of what it points to.

f
Deno.makeTempDir

Creates a new temporary directory in the default directory for temporary files, unless dir is specified. Other optional options include prefixing and suffixing the directory name with prefix and suffix respectively.

f
Deno.makeTempDirSync

Synchronously creates a new temporary directory in the default directory for temporary files, unless dir is specified. Other optional options include prefixing and suffixing the directory name with prefix and suffix respectively.

f
Deno.makeTempFile

Creates a new temporary file in the default directory for temporary files, unless dir is specified.

f
Deno.makeTempFileSync

Synchronously creates a new temporary file in the default directory for temporary files, unless dir is specified.

f
Deno.mkdir

Creates a new directory with the specified path.

f
Deno.mkdirSync

Synchronously creates a new directory with the specified path.

f
Deno.open

Open a file and resolve to an instance of Deno.FsFile. The file does not need to previously exist if using the create or createNew open options. The caller may have the resulting file automatically closed by the runtime once it's out of scope by declaring the file variable with the using keyword.

f
Deno.openSync

Synchronously open a file and return an instance of Deno.FsFile. The file does not need to previously exist if using the create or createNew open options. The caller may have the resulting file automatically closed by the runtime once it's out of scope by declaring the file variable with the using keyword.

f
Deno.readDir

Reads the directory given by path and returns an async iterable of Deno.DirEntry. The order of entries is not guaranteed.

f
Deno.readDirSync

Synchronously reads the directory given by path and returns an iterable of Deno.DirEntry. The order of entries is not guaranteed.

f
Deno.readFile

Reads and resolves to the entire contents of a file as an array of bytes. TextDecoder can be used to transform the bytes to string if required. Reading a directory returns an empty data array.

f
Deno.readFileSync

Synchronously reads and returns the entire contents of a file as an array of bytes. TextDecoder can be used to transform the bytes to string if required. Reading a directory returns an empty data array.

f
Deno.readLinkSync

Synchronously returns the full path destination of the named symbolic link.

f
Deno.readTextFile

Asynchronously reads and returns the entire contents of a file as an UTF-8 decoded string. Reading a directory throws an error.

f
Deno.readTextFileSync

Synchronously reads and returns the entire contents of a file as an UTF-8 decoded string. Reading a directory throws an error.

f
Deno.realPath

Resolves to the absolute normalized path, with symbolic links resolved.

f
Deno.realPathSync

Synchronously returns absolute normalized path, with symbolic links resolved.

f
Deno.remove

Removes the named file or directory.

f
Deno.removeSync

Synchronously removes the named file or directory.

f
Deno.rename

Renames (moves) oldpath to newpath. Paths may be files or directories. If newpath already exists and is not a directory, rename() replaces it. OS-specific restrictions may apply when oldpath and newpath are in different directories.

f
Deno.renameSync

Synchronously renames (moves) oldpath to newpath. Paths may be files or directories. If newpath already exists and is not a directory, renameSync() replaces it. OS-specific restrictions may apply when oldpath and newpath are in different directories.

f
Deno.stat

Resolves to a Deno.FileInfo for the specified path. Will always follow symlinks.

f
Deno.statSync

Synchronously returns a Deno.FileInfo for the specified path. Will always follow symlinks.

f
Deno.symlinkSync

Creates newpath as a symbolic link to oldpath.

f
Deno.truncate

Truncates (or extends) the specified file, to reach the specified len. If len is not specified then the entire file contents are truncated.

f
Deno.truncateSync

Synchronously truncates (or extends) the specified file, to reach the specified len. If len is not specified then the entire file contents are truncated.

f
Deno.umask

Retrieve the process umask. If mask is provided, sets the process umask. This call always returns what the umask was before the call.

f
Deno.utime

Changes the access (atime) and modification (mtime) times of a file system object referenced by path. Given times are either in seconds (UNIX epoch time) or as Date objects.

f
Deno.utimeSync

Synchronously changes the access (atime) and modification (mtime) times of a file system object referenced by path. Given times are either in seconds (UNIX epoch time) or as Date objects.

f
Deno.watchFs

Watch for file system events against one or more paths, which can be files or directories. These paths must exist already. One user action (e.g. touch test.file) can generate multiple file system events. Likewise, one user action can result in multiple file paths in one event (e.g. mv old_name.txt new_name.txt).

f
Deno.writeFile

Write data to the given path, by default creating a new file if needed, else overwriting.

f
Deno.writeFileSync

Synchronously write data to the given path, by default creating a new file if needed, else overwriting.

f
Deno.writeTextFile

Write string data to the given path, by default creating a new file if needed, else overwriting.

f
Deno.writeTextFileSync

Synchronously write string data to the given path, by default creating a new file if needed, else overwriting.

f
Deno.fstat

Returns a Deno.FileInfo for the given file stream.

f
Deno.fstatSync

Synchronously returns a Deno.FileInfo for the given file stream.

f
Deno.ftruncate

Truncates or extends the specified file stream, to reach the specified len.

f
Deno.ftruncateSync

Synchronously truncates or extends the specified file stream, to reach the specified len.

f
Deno.futime

Changes the access (atime) and modification (mtime) times of a file stream resource referenced by rid. Given times are either in seconds (UNIX epoch time) or as Date objects.

f
Deno.futimeSync

Synchronously changes the access (atime) and modification (mtime) times of a file stream resource referenced by rid. Given times are either in seconds (UNIX epoch time) or as Date objects.

Interfaces

I
Deno.DirEntry

Information about a directory entry returned from Deno.readDir and Deno.readDirSync.

I
Deno.FileInfo

Provides information about a file and is returned by Deno.stat, Deno.lstat, Deno.statSync, and Deno.lstatSync or from calling stat() and statSync() on an Deno.FsFile instance.

I
Deno.FsEvent

Represents a unique file system event yielded by a Deno.FsWatcher.

I
Deno.FsWatcher

Returned by Deno.watchFs. It is an async iterator yielding up system events. To stop watching the file system by calling .close() method.

I
Deno.MkdirOptions

Options which can be set when using Deno.mkdir and Deno.mkdirSync.

I
Deno.OpenOptions

Options which can be set when doing Deno.open and Deno.openSync.

I
Deno.ReadFileOptions

Options which can be set when using Deno.readFile or Deno.readFileSync.

I
Deno.RemoveOptions

Options which can be set when using Deno.remove and Deno.removeSync.

I
Deno.SymlinkOptions

Options that can be used with symlink and symlinkSync.

I
Deno.WriteFileOptions

Options for writing to a file.

Type Aliases

T
Deno.FsEventFlag

Additional information for FsEvent objects with the "other" kind.

Variables

v
Deno.File

The Deno abstraction for reading and writing files.