summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-05-28 19:07:47 +0100
committerMichael Williamson <mike@zwobble.org>2023-05-28 19:07:47 +0100
commitad794b956a6c67e2e903d095a66455d512b004b7 (patch)
tree05311fe43b32001ebfead7b5dd3084b7a0657a14
parent20dda846ccfa12789c33e62c4bad58ce7841955d (diff)
Document that read methods return promises
-rw-r--r--README.md7
1 files changed, 5 insertions, 2 deletions
diff --git a/README.md b/README.md
index cb3d937..d188c0f 100644
--- a/README.md
+++ b/README.md
@@ -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.