@ui5/fs/ResourceFacade
@ui5/fs/ResourceFacade
A Resource with a different path than it's original
Constructor
new @ui5/fs/ResourceFacade(parameters)
Source: fs/lib/ResourceFacade.js, line 10
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
parameters | object | Parameters Properties:
|
Methods
Description: Returns a clone of the resource. The clones content is independent from that of the original resource. A ResourceFacade becomes a Resource
Source: fs/lib/ResourceFacade.js, line 85
Returns:
Promise resolving with the clone
Type: Promise<@ui5/fs/Resource>
(async) getBuffer() → {Promise<Buffer>}
Description: Gets a buffer with the resource content.
Source: fs/lib/ResourceFacade.js, line 103
Returns:
Promise resolving with a buffer of the resource content.
Type: Promise<Buffer>
getLastModified() → {number}
Description: Gets the last modified timestamp of the resource.
Source: fs/lib/ResourceFacade.js, line 232
Returns:
Last modified timestamp (in milliseconds since UNIX epoch)
Type: number
getName() → {string}
Description: Gets the resource name
Source: fs/lib/ResourceFacade.js, line 64
Returns:
Name of the resource
Type: string
getOriginalPath() → {string}
Description: Gets the path original resource's path
Source: fs/lib/ResourceFacade.js, line 54
Returns:
(Virtual) path of the resource
Type: string
getPath() → {string}
Description: Gets the resources path
Source: fs/lib/ResourceFacade.js, line 44
Returns:
(Virtual) path of the resource
Type: string
getProject() → {@ui5/project/specifications/Project}
Description: Retrieve the project assigned to the resource
Note for UI5 CLI extensions (i.e. custom tasks, custom middleware): In order to ensure compatibility across UI5 CLI versions, consider using the getProject(resource) method provided by TaskUtil and MiddlewareUtil, which will return a Specification Version-compatible Project interface.
Source: fs/lib/ResourceFacade.js, line 292
Returns:
Project this resource is associated with
Type: @ui5/project/specifications/Project
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: fs/lib/ResourceFacade.js, line 212
Deprecated: Use dedicated APIs like Resource.getSize(), .isDirectory(), .getLastModified() instead
Returns:
Instance of fs.Stats or similar object
Type: fs.Stats | object
getStream() → {stream.Readable}
Description: Gets a readable stream for the resource content.
Repetitive calls of this function are only possible if new content has been set in the meantime (through setStream, setBuffer or setString). This is to prevent subsequent consumers from accessing drained streams.
Source: fs/lib/ResourceFacade.js, line 149
Deprecated: Use asynchronous Resource.getStreamAsync() instead
Returns:
Readable stream for the resource content.
Type: stream.Readable
(async) getStreamAsync() → {Promise<stream.Readable>}
Description: Gets a readable stream for the resource content.
Repetitive calls of this function are only possible if new content has been set in the meantime (through setStream, setBuffer or setString). This is to prevent subsequent consumers from accessing drained streams.
For atomic operations, please use modifyStream
Source: fs/lib/ResourceFacade.js, line 166
Returns:
Promise resolving with a readable stream for the resource content.
Type: Promise<stream.Readable>
getString() → {Promise<string>}
Description: Gets a string with the resource content.
Source: fs/lib/ResourceFacade.js, line 123
Returns:
Promise resolving with the resource content.
Type: Promise<string>
hasProject() → {boolean}
Description: Check whether a project has been assigned to the resource
Source: fs/lib/ResourceFacade.js, line 312
Returns:
True if the resource is associated with a project
Type: boolean
hasSize() → {boolean}
Description: Checks whether the resource size can be determined without reading the entire content. E.g. for buffer-based content or if the size has been provided when the resource was created.
Source: fs/lib/ResourceFacade.js, line 253
Returns:
True if size can be determined statically
Type: boolean
isDirectory() → {boolean}
Description: Checks whether the resource represents a directory.
Source: fs/lib/ResourceFacade.js, line 222
Returns:
True if resource is a directory
Type: boolean
isModified() → {boolean}
Description: Check whether the content of this resource has been changed during its life cycle
Source: fs/lib/ResourceFacade.js, line 321
Returns:
True if the resource's content has been changed
Type: boolean
setBuffer(buffer)
Description: Sets a Buffer as content.
Source: fs/lib/ResourceFacade.js, line 113
Parameters:
| Name | Type | Description |
|---|---|---|
buffer | Buffer | Buffer instance |
setPath(path)
Description: Sets the resources path
Source: fs/lib/ResourceFacade.js, line 74
Parameters:
| Name | Type | Description |
|---|---|---|
path | string | (Virtual) path of the resource |
setProject(project)
Description: Assign a project to the resource
Source: fs/lib/ResourceFacade.js, line 302
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: fs/lib/ResourceFacade.js, line 189
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: fs/lib/ResourceFacade.js, line 133
Parameters:
| Name | Type | Description |
|---|---|---|
string | string | Resource content |

