Skip to main content

IDirectory Interface

Interface describing actions on a directory.

This API is provided for existing users, but is not recommended for new users.

To use, import via fluid-framework/legacy.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature

/** @sealed */
export interface IDirectory extends Map<string, any>, IEventProvider<IDirectoryEvents>, Partial<IDisposable>

Extends: Map<string, any>, IEventProvider<IDirectoryEvents>, Partial<IDisposable>

Remarks

When used as a Map, operates on its keys.

Properties

Property Modifiers Type Description
absolutePath readonly string The absolute path of the directory.

Methods

Method Modifiers Return Type Description
countSubDirectory() optional number Get the number of sub directory within the directory.
createSubDirectory(subdirName) IDirectory Creates an IDirectory child of this IDirectory, or retrieves the existing IDirectory child if one with the same name already exists.
deleteSubDirectory(subdirName) boolean Deletes an IDirectory child of this IDirectory, if it exists, along with all descendent keys and directories.
get(key) T | undefined Retrieves the value stored at the given key from the directory.
getSubDirectory(subdirName) IDirectory | undefined Gets an IDirectory child of this IDirectory, if it exists.
getWorkingDirectory(relativePath) IDirectory | undefined Get an IDirectory within the directory, in order to use relative paths from that location.
hasSubDirectory(subdirName) boolean Checks whether this directory has a child directory with the given name.
set(key, value) this Sets the value stored at key to the provided value.
subdirectories() IterableIterator<[string, IDirectory]> Gets an iterator over the IDirectory children of this IDirectory.

Property Details

absolutePath

The absolute path of the directory.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature
readonly absolutePath: string;

Type: string

Method Details

countSubDirectory

Get the number of sub directory within the directory.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature
countSubDirectory?(): number;

Returns

The number of sub directory within a directory.

Return type: number

createSubDirectory

Creates an IDirectory child of this IDirectory, or retrieves the existing IDirectory child if one with the same name already exists.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature
createSubDirectory(subdirName: string): IDirectory;

Parameters

Parameter Type Description
subdirName string Name of the new child directory to create

Returns

The IDirectory child that was created or retrieved

Return type: IDirectory

deleteSubDirectory

Deletes an IDirectory child of this IDirectory, if it exists, along with all descendent keys and directories.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature
deleteSubDirectory(subdirName: string): boolean;

Parameters

Parameter Type Description
subdirName string Name of the child directory to delete

Returns

True if the IDirectory existed and was deleted, false if it did not exist

Return type: boolean

get

Retrieves the value stored at the given key from the directory.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature
get<T = any>(key: string): T | undefined;
Type Parameters
Parameter Default Description
T any

Parameters

Parameter Type Description
key string Key to retrieve from

Returns

The stored value, or undefined if the key is not set

Return type: T | undefined

getSubDirectory

Gets an IDirectory child of this IDirectory, if it exists.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature
getSubDirectory(subdirName: string): IDirectory | undefined;

Parameters

Parameter Type Description
subdirName string Name of the child directory to get

Returns

The requested IDirectory

Return type: IDirectory | undefined

getWorkingDirectory

Get an IDirectory within the directory, in order to use relative paths from that location.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature
getWorkingDirectory(relativePath: string): IDirectory | undefined;

Parameters

Parameter Type Description
relativePath string Path of the IDirectory to get, relative to this IDirectory

Returns

The requested IDirectory

Return type: IDirectory | undefined

hasSubDirectory

Checks whether this directory has a child directory with the given name.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature
hasSubDirectory(subdirName: string): boolean;

Parameters

Parameter Type Description
subdirName string Name of the child directory to check

Returns

True if it exists, false otherwise

Return type: boolean

set

Sets the value stored at key to the provided value.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature
set<T = unknown>(key: string, value: T): this;
Type Parameters
Parameter Default Description
T unknown

Parameters

Parameter Type Description
key string Key to set at
value T Value to set

Returns

The IDirectory itself

Return type: this

subdirectories

Gets an iterator over the IDirectory children of this IDirectory.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature
subdirectories(): IterableIterator<[string, IDirectory]>;

Returns

The IDirectory iterator

Return type: IterableIterator<[string, IDirectory]>