diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-05-28 19:07:47 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-05-28 19:07:47 +0100 |
| commit | ad794b956a6c67e2e903d095a66455d512b004b7 (patch) | |
| tree | 05311fe43b32001ebfead7b5dd3084b7a0657a14 /README.md | |
| parent | 20dda846ccfa12789c33e62c4bad58ce7841955d (diff) | |
Document that read methods return promises
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -482,15 +482,18 @@ and has the following properties: * `contentType`: the content type of the image, such as `image/png`. * `readAsArrayBuffer()`: read the image file as an `ArrayBuffer`. + Returns a promise of an `ArrayBuffer`. * `readAsBuffer()`: read the image file as a `Buffer`. + Returns a promise of a `Buffer`. This is not supported in browsers unless a `Buffer` polyfill has been used. * `readAsBase64String()`: read the image file as a base64-encoded string. + Returns a promise of a `string`. * `read([encoding])` (deprecated): read the image file with the specified encoding. - If an encoding is specified, a `string` is returned. - If no encoding is specified, a `Buffer` is returned. + If an encoding is specified, a promise of a `string` is returned. + If no encoding is specified, a promise of a `Buffer` is returned. `func` should return an object (or a promise of an object) of attributes for the `<img>` element. At a minimum, this should include the `src` attribute. |
