Skip to content

Commit d60a685

Browse files
committed
docs: update image loading via browser
1 parent ed6bd73 commit d60a685

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

docs/Getting started.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const parsedImage = readSync('../example.jpg');
4343
```
4444

4545
:::tip
46-
Node.js can also load an image via `fetch` function. To get more information take a look at "Browser" part of this section.
46+
Node.js can also load an image via `fetchURL`. To get more information take a look at "Browser" part of this section.
4747
:::
4848

4949
Once the image is loaded, it returns an instance of the `Image` class, so its methods can be applied.
@@ -72,13 +72,12 @@ writeSync('../example.jpg', image);
7272

7373
### Loading your first image in browser
7474

75-
To load an image via browser, in order to instantiate it, you need to get an `arrayBuffer`. One of the ways :
75+
To load an image via browser, in order to instantiate it, you may use `fetchURL` function:
7676

7777
```ts
78-
const data = await fetch('https:://example.com/image.jpg');
79-
const bufferedData = await data.arrayBuffer();
80-
let image = decode(new DataView(bufferedData)); // image is ready for usage
78+
import { fetchURL } from 'image-js';
8179

80+
let image = await fetchURL('https:://example.com/image.jpg'); // image is ready for usage
8281
image = image.grey();
8382
```
8483

0 commit comments

Comments
 (0)