WARNING: The [sjs-3] engine was deprecated, use [sjs-4] instead. See sjs-4: root.

File.prototype.root()

Return the root file.

Syntax

file.root() File file.root(cross bool) File

Parameters

cross bool (default false)

Cross filesystem boundaries. Getting the root file from within an imported filesystem returns the root file of the imported filesystem, unless crossing is enabled, in which case it returns the highest root.

Description

Return the root file of the filesystem which the referenced file is part of.

Examples

Basic example.

Cross filesystem boundaries. Note that in this playground, we can not import remote filesystems, thus we can not show the difference here of using the cross argument.