Skip to content

@ui5/fs/WriterCollection

@ui5/fs/WriterCollection

Resource Locator WriterCollection

Constructor

new @ui5/fs/WriterCollection(parameters)

Description: The constructor.

Source: fs/lib/WriterCollection.js, line 13

Parameters:
NameTypeDescription
parametersobjectParameters
Properties:
NameTypeDescription
namestringThe collection name
writerMappingobject<string, @ui5/fs/AbstractReaderWriter>Mapping of virtual base paths to writers. Path are matched greedy


new WriterCollection({
name: "Writer Collection",
writerMapping: {
"/": writerA,
"/my/path/": writerB,
}
});

Extends

Methods

byGlob(virPattern, optionsopt) → {Promise<Array<@ui5/fs/Resource>>}

Description: Locates resources by matching glob patterns.

js
byGlob("**‏/*.{html,htm}");
byGlob("**‏/.library");
byGlob("/pony/*");

Source: fs/lib/AbstractReader.js, line 51

Overrides: @ui5/fs/AbstractReaderWriter#byGlob

Parameters:
NameTypeAttributesDescription
virPatternstring | Array<string>glob pattern as string or array of glob patterns for
virtual directory structure
optionsobjectoptionalglob options
Properties:
NameTypeAttributesDefaultDescription
nodirbooleanoptionaltrueDo not match directories
Returns:

Promise resolving to list of resources

Type: Promise<Array<@ui5/fs/Resource>>

byPath(virPath, optionsopt) → {Promise<@ui5/fs/Resource>}

Description: Locates resources by matching a given path.

Source: fs/lib/AbstractReader.js, line 78

Overrides: @ui5/fs/AbstractReaderWriter#byPath

Parameters:
NameTypeAttributesDescription
virPathstringVirtual path
optionsobjectoptionalOptions
Properties:
NameTypeAttributesDefaultDescription
nodirbooleanoptionaltrueDo not match directories
Returns:

Promise resolving to a single resource

Type: Promise<@ui5/fs/Resource>

write(resource, optionsopt) → {Promise<undefined>}

Description: Writes the content of a resource to a path.

Source: fs/lib/AbstractReaderWriter.js, line 53

Overrides: @ui5/fs/AbstractReaderWriter#write

Parameters:
NameTypeAttributesDescription
resource@ui5/fs/ResourceResource to write
optionsobjectoptional
Properties:
NameTypeAttributesDefaultDescription
readOnlybooleanoptionalfalseWhether the resource content shall be written read-only
Do not use in conjunction with the drain option.
The written file will be used as the new source of this resources content.
Therefore the written file should not be altered by any means.
Activating this option might improve overall memory consumption.
drainbooleanoptionalfalseWhether the resource content shall be emptied during the write process.
Do not use in conjunction with the readOnly option.
Activating this option might improve overall memory consumption.
This should be used in cases where this is the last access to the resource.
E.g. the final write of a resource after all processing is finished.
Returns:

Promise resolving once data has been written

Type: Promise<undefined>