Skip to main content
File System - Deno documentation

Classes

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 ofspecified 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 targetpath is a directory or is unwritable.

f
Deno.copyFileSync

Synchronously copies the contents and permissions of one file to anotherspecified 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 toan instance of Deno.FsFile.

f
Deno.createSync

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

f
Deno.linkSync

Synchronously creates newpath as a hard link to oldpath.

f
Deno.lstat

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

f
Deno.lstatSync

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

f
Deno.makeTempDir

Creates a new temporary directory in the default directory for temporaryfiles, unless dir is specified. Other optional options includeprefixing and suffixing the directory name with prefix and suffixrespectively.

f
Deno.makeTempDirSync

Synchronously creates a new temporary directory in the default directoryfor temporary files, unless dir is specified. Other optional optionsinclude prefixing and suffixing the directory name with prefix andsuffix respectively.

f
Deno.makeTempFile

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

f
Deno.makeTempFileSync

Synchronously creates a new temporary file in the default directory fortemporary 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. Thefile does not need to previously exist if using the create or createNewopen options. The caller may have the resulting file automatically closedby the runtime once it's out of scope by declaring the file variable withthe using keyword.

f
Deno.openSync

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

f
Deno.readDir

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

f
Deno.readDirSync

Synchronously reads the directory given by path and returns an iterableof 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 arrayof bytes. TextDecoder can be used to transform the bytes to string ifrequired. Reading a directory returns an empty data array.

f
Deno.readLinkSync

Synchronously returns the full path destination of the named symboliclink.

f
Deno.readTextFile

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

f
Deno.readTextFileSync

Synchronously reads and returns the entire contents of a file as an UTF-8decoded 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 linksresolved.

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 indifferent directories.

f
Deno.renameSync

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

f
Deno.stat

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

f
Deno.statSync

Synchronously returns a Deno.FileInfo for the specifiedpath. 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 thespecified len. If len is not specified then the entire file contentsare 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 filesystem 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) timesof a file system object referenced by path. Given times are either inseconds (UNIX epoch time) or as Date objects.

f
Deno.watchFs

Watch for file system events against one or more paths, which can befiles 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 ifneeded, else overwriting.

f
Deno.writeFileSync

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

f
Deno.writeTextFile

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

f
Deno.writeTextFileSync

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

Interfaces

I
Deno.DirEntry

Information about a directory entry returned from Deno.readDirand Deno.readDirSync.

I
Deno.FsEvent

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

I
Deno.FsWatcher

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

I
Deno.MkdirOptions

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

I
Deno.ReadFileOptions

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

I
Deno.RemoveOptions

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

I
Deno.SymlinkOptions

Options that can be used with symlink andsymlinkSync.

I

Type Aliases

T
Deno.FsEventFlag

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