Constructor
new @ui5/fs/Resource(parameters)
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
parameters |
object | Parameters
Properties
|
Methods
(async) clone() → {Promise.<@ui5/fs/Resource>}
- Description:
- Returns a clone of the resource. The clones content is independent from that of the original resource
- Source:
Returns:
Promise resolving with the clone
- Type
- Promise.<@ui5/fs/Resource>
(async) getBuffer() → {Promise.<Buffer>}
- Description:
- Gets a buffer with the resource content.
- Source:
Returns:
Promise resolving with a buffer of the resource content.
- Type
- Promise.<Buffer>
getName() → {string}
- Description:
- Gets the resource name
- Source:
Returns:
Name of the resource
- Type
- string
getPath() → {string}
- Description:
- Gets the virtual resources path
- Source:
Returns:
Virtual path of the resource
- Type
- string
getProject() → {@ui5/project/specifications/Project}
- Description:
- Retrieve the project assigned to the resource
Note for UI5 Tooling extensions (i.e. custom tasks, custom middleware): In order to ensure compatibility across UI5 Tooling versions, consider using thegetProject(resource)
method provided by TaskUtil and MiddlewareUtil, which will return a Specification Version-compatible Project interface.
- Retrieve the project assigned to the resource
- Source:
Returns:
Project this resource is associated with
getStatInfo() → {fs.Stats|object}
- Description:
- Gets the resources stat info. Note that a resources stat information is not updated when the resource is being modified. Also, depending on the used adapter, some fields might be missing which would be present for a fs.Stats instance.
- Source:
Returns:
Instance of fs.Stats
or similar object
- Type
- fs.Stats | object
getStream() → {stream.Readable}
- Description:
- Source:
Returns:
Readable stream for the resource content.
- Type
- stream.Readable
getString() → {Promise.<string>}
- Description:
- Gets a string with the resource content.
- Source:
Returns:
Promise resolving with the resource content.
- Type
- Promise.<string>
hasProject() → {boolean}
- Description:
- Check whether a project has been assigned to the resource
- Source:
Returns:
True if the resource is associated with a project
- Type
- boolean
isModified() → {boolean}
- Description:
- Check whether the content of this resource has been changed during its life cycle
- Source:
Returns:
True if the resource's content has been changed
- Type
- boolean
setBuffer(buffer)
- Description:
- Sets a Buffer as content.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
buffer |
Buffer | Buffer instance |
setPath(path)
- Description:
- Sets the virtual resources path
- Source:
Parameters:
Name | Type | Description |
---|---|---|
path |
string | Absolute virtual path of the resource |
setProject(project)
- Description:
- Assign a project to the resource
- Source:
Parameters:
Name | Type | Description |
---|---|---|
project |
@ui5/project/specifications/Project | Project this resource is associated with |
setStream(stream)
- Description:
- Sets a readable stream as content.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stream |
stream.Readable | @ui5/fs/Resource~createStream | Readable stream of the resource content or callback for dynamic creation of a readable stream |
setString(string)
- Description:
- Sets a String as content
- Source:
Parameters:
Name | Type | Description |
---|---|---|
string |
string | Resource content |
Type Definitions
createStream() → {stream.Readable}
- Description:
- Function for dynamic creation of content streams
- Source:
Returns:
A readable stream of a resources content
- Type
- stream.Readable