Skip to main content Link Search Menu Expand Document (external link)

Fs overview

A module that applies the concept of branding to filepaths


Table of contents


Branding

FileBrand (type alias)

Brand that represents a file

Signature

export type FileBrand = Brand.Branded<string, `${moduleTag}FileBrand`>

Filename (type alias)

Brand that represents a filename

Signature

export type Filename = FileBrand & NameBrand

Filepath (type alias)

Brand that represents a file path

Signature

export type Filepath = FileBrand & PathBrand

FolderBrand (type alias)

Brand that represents a folder

Signature

export type FolderBrand = Brand.Branded<string, `${moduleTag}FolderBrand`>

Foldername (type alias)

Brand that represents a foldername

Signature

export type Foldername = FolderBrand & NameBrand

Folderpath (type alias)

Brand that represents a folder path

Signature

export type Folderpath = FolderBrand & PathBrand

Name (type alias)

Brand that represents a filename or a folder name

Signature

export type Name = Filename | Foldername

NameBrand (type alias)

Brand that represents a name

Signature

export type NameBrand = Brand.Branded<string, `${moduleTag}NameBrand`>

Path (type alias)

Brand that represents a file path or a folder path

Signature

export type Path = Filepath | Folderpath

PathBrand (type alias)

Brand that represents a path

Signature

export type PathBrand = Brand.Branded<string, `${moduleTag}PathBrand`>

Constructors

Filename

Filename constructor

Signature

export declare const Filename: Brand.Brand.Constructor<Filename>

Filepath

Filename constructor

Signature

export declare const Filepath: Brand.Brand.Constructor<Filepath>

Foldername

Foldername constructor

Signature

export declare const Foldername: Brand.Brand.Constructor<Foldername>

Folderpath

Folder path constructor

Signature

export declare const Folderpath: Brand.Brand.Constructor<Folderpath>

Name

Name constructor

Signature

export declare const Name: Brand.Brand.Constructor<Name>

Path

Path constructor

Signature

export declare const Path: Brand.Brand.Constructor<Path>

Models

moduleTag

Module tag

Signature

export declare const moduleTag: "@parischap/effect-lib/Fs/"

Utility types

ToName (type alias)

Type utility that turns a path into a name

Signature

export type ToName<P extends Path> = readonly [P] extends readonly [Filepath]
  ? Filename
  : readonly [P] extends readonly [Folderpath]
    ? Foldername
    : Name

ToPath (type alias)

Type utility that turns a file system name into a path

Signature

export type ToPath<N extends Name> = readonly [N] extends readonly [Filename]
  ? Filepath
  : readonly [N] extends readonly [Foldername]
    ? Folderpath
    : Path