Skip to content

Commit 4045212

Browse files
remove outdated docs (#1301)
1 parent ecc492d commit 4045212

File tree

1 file changed

+4
-53
lines changed

1 file changed

+4
-53
lines changed

plugins/plugin-cover/README.md

+4-53
Original file line numberDiff line numberDiff line change
@@ -131,57 +131,8 @@ Jimp.read({
131131
});
132132
```
133133

134-
Jimp uses [phin](https://github.com/ethanent/phin) as its HTTP client. Phin uses [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback) or [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) methods for making HTTP requests. Phin parses a `url` with the `url.parse(...)` method and passes it with all the other parameters as an `options` to the [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback) or [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) methods.
135-
136-
Briefly speaking, you can pass any options from [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback), [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) or even [`tls.connect(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/tls.html#tls_tls_connect_options_callback).
137-
138-
Phin parses a `url` and combines it with any options you want. This behavior can be very useful when you need to pass some additional `headers`. Also, you can pass `rejectUnauthorized: false` if you don't require an SSL certificate to be valid (it helps to prevent `unable to verify the first certificate` error).
139-
140134
The convenience method `Jimp.create` also exists. It is just a wrapper around `Jimp.read`.
141135

142-
### Custom Constructor
143-
144-
You might want to initialize jimp in so custom way. To do this Jimp exposes the static function `appendConstructorOption`. The appended constructor options run after all the defaults.
145-
146-
To define a custom constructor provide a name for it, a function to call to determine if the arguments provided to jimp match your constructor, and a function called where you can construct the image however you want.
147-
148-
```js
149-
Jimp.appendConstructorOption(
150-
"Name of Option",
151-
(args) => arg.hasSomeCustomThing,
152-
function (resolve, reject, args) {
153-
this.bitmap = customParser(args);
154-
resolve();
155-
},
156-
);
157-
```
158-
159-
If you don't want to handle parsing the bitmap. For example if you want to do some sort of authentication for URL request. Jimp exposes `parseBitmap` so you can fall back to jimp to do the heavy lifting.
160-
161-
Parse bitmap takes the raw image data in a Buffer, a path (optional), and a node style callback.
162-
163-
```js
164-
Jimp.appendConstructorOption(
165-
"Custom Url",
166-
(options) => options.url,
167-
function (resolve, reject, options) {
168-
phin(options, (err, res) => {
169-
if (err) {
170-
return reject(err);
171-
}
172-
173-
this.parseBitmap(res.body, options.url, (err) => {
174-
if (err) {
175-
return reject(err);
176-
}
177-
178-
resolve();
179-
});
180-
});
181-
},
182-
);
183-
```
184-
185136
### Methods
186137

187138
Once the promise is fulfilled, the following methods can be called on the image:
@@ -373,7 +324,7 @@ Jimp.loadFont(pathOrURL).then((font) => {
373324
alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE,
374325
},
375326
maxWidth,
376-
maxHeight,
327+
maxHeight
377328
); // prints 'Hello world!' on an image, middle and center-aligned, when x = 0 and y = 0
378329
});
379330
```
@@ -418,7 +369,7 @@ Jimp.measureText(await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK), "Some string"); /
418369
Jimp.measureTextHeight(
419370
await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK),
420371
"Some string",
421-
100,
372+
100
422373
); // height of text
423374
```
424375

@@ -436,7 +387,7 @@ Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then((font) => {
436387
50,
437388
(err, image, { x, y }) => {
438389
image.print(font, x, y + 20, "More text on another line", 50);
439-
},
390+
}
440391
);
441392
});
442393
```
@@ -626,7 +577,7 @@ for (const { x, y, idx, image } of image.scanIterator(
626577
0,
627578
0,
628579
image.bitmap.width,
629-
image.bitmap.height,
580+
image.bitmap.height
630581
)) {
631582
}
632583
```

0 commit comments

Comments
 (0)