Skip to content

FileSystem

File system utilities.

Initializers

import { FileSystem } from '@alicloud/ros-cdk-core'
new FileSystem()
Name Type Description

Static Functions

Name Description
copyDirectory Copies an entire directory structure.
fingerprint Produces fingerprint based on the contents of a single file or an entire directory tree.
isEmpty Checks whether a directory is empty.
mkdtemp Creates a unique temporary directory in the system temp directory.

copyDirectory

import { FileSystem } from '@alicloud/ros-cdk-core'
FileSystem.copyDirectory(srcDir: string, destDir: string, options?: CopyOptions, rootDir?: string)

Copies an entire directory structure.

srcDirRequired

  • Type: string

Source directory.


destDirRequired

  • Type: string

Destination directory.


optionsOptional

options.


rootDirOptional

  • Type: string

Root directory to calculate exclusions from.


fingerprint

import { FileSystem } from '@alicloud/ros-cdk-core'
FileSystem.fingerprint(fileOrDirectory: string, options?: FingerprintOptions)

Produces fingerprint based on the contents of a single file or an entire directory tree.

Line endings are converted from CRLF to LF.

The fingerprint will also include: 1. An extra string if defined in options.extra. 2. The symlink follow mode value.

fileOrDirectoryRequired

  • Type: string

The directory or file to fingerprint.


optionsOptional

Fingerprinting options.


isEmpty

import { FileSystem } from '@alicloud/ros-cdk-core'
FileSystem.isEmpty(dir: string)

Checks whether a directory is empty.

dirRequired

  • Type: string

The directory to check.


mkdtemp

import { FileSystem } from '@alicloud/ros-cdk-core'
FileSystem.mkdtemp(prefix: string)

Creates a unique temporary directory in the system temp directory.

prefixRequired

  • Type: string

A prefix for the directory name.

Six random characters will be generated and appended behind this prefix.


Properties

Name Type Description
tmpdir string The real path of the system temp directory.

tmpdirRequired

public readonly tmpdir: string;
  • Type: string

The real path of the system temp directory.