Constructor
new Homey.Image()
Properties:
| Name | Type | Description | 
|---|---|---|
| cloudUrl | string | The public URL to this image using Athom's cloud proxy (HTTPS) | 
| localUrl | string | The public URL to this image using Homey's local IP address (HTTP) | 
Methods
getBuffer(callback) → {Promise}
Get the Buffer
- Deprecated:
- Use Image#getStream or Image#pipe
 
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| callback | function | 
 | 
Returns:
- Type:
- 
        
Promise
getFormat() → {String}
Get the format
- Deprecated:
- Use Image#ImageStreamMetadata properties through Image#getStream and Image#pipe
 
Returns:
- Type:
- 
        
String
format Either png, jpg or gif
(async) getStream() → {Readable}
Returns a stream containing the image data.
- Since:
- 2.2.0
 
Returns:
- Type:
- 
        
Readable
A nodejs stream containing the image data. The readable stream contains metadata properties (Image#ImageStreamMetadata)
(async) pipe(target) → {Image#ImageStreamMetadata}
Pipe the image into the target stream and returns metadata.
- Since:
- 2.2.0
 
Parameters:
| Name | Type | Description | 
|---|---|---|
| target | WritableStream | 
register(callbackopt) → {Promise}
Register the image. This is a shorthand method for ManagerImages#registerImage.
Parameters:
| Name | Type | Attributes | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| callback | function | <optional> | 
 | 
Returns:
- Type:
- 
        
Promise
setBuffer(source)
Set the image's data
- Deprecated:
- Use Image#setStream
 
Parameters:
| Name | Type | Description | 
|---|---|---|
| source | Buffer|function | A buffer of the image, or a Function. When provided a function, this will be called with parameters  | 
setPath(path)
Set the image's path
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | String | Relative path to your image, e.g.  | 
setStream(source)
Set the image's data.
- Since:
- 2.2.0
 
- Library:
Parameters:
| Name | Type | Description | 
|---|---|---|
| source | function | This function will be called with the parameter  | 
setUrl(url)
Set the image's URL. This URL must be accessible from any network.
Parameters:
| Name | Type | Description | 
|---|---|---|
| url | String | Absolute url,  | 
unregister(callbackopt) → {Promise}
Unregister the image. This is a shorthand method for ManagerImages#unregisterImage.
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| callback | genericCallbackFunction | <optional> | 
Returns:
- Type:
- 
        
Promise
update(callback) → {Promise}
Notify that the image's contents have changed
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
| callback | 
 | 
Returns:
- Type:
- 
        
Promise
Type Definitions
ImageStreamMetadata
Properties:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| filename | string | A filename for this image | |
| contentType | string | The mime type of this image | |
| contentLength | number | <optional> | The size in bytes, if available | 
 You are currently viewing the Homey Apps SDK v2 documentation. New apps should use Homey Apps SDK v3 ››
      You are currently viewing the Homey Apps SDK v2 documentation. New apps should use Homey Apps SDK v3 ››