Skip to main content
Version: Next

MockDirectoryContent

Home > @backstage/backend-test-utils > MockDirectoryContent

The content of a mock directory represented by a nested object structure.

Signature:

export type MockDirectoryContent = {
[name in string]: MockDirectoryContent | string | Buffer | MockDirectoryContentCallback;
};

References: MockDirectoryContent, MockDirectoryContentCallback

Remarks

When used as input, the keys may contain forward slashes to indicate nested directories. Then returned as output, each directory will always be represented as a separate object.

Example

{
'test.txt': 'content',
'sub-dir': {
'file.txt': 'content',
'nested-dir/file.txt': 'content',
},
'empty-dir': {},
'binary-file': Buffer.from([0, 1, 2]),
}