screenshotone-api-sdk 1.0.17 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +29 -17
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
- # tssdk
1
+ # jssdk
2
2
 
3
- [![Build](https://github.com/screenshotone/tssdk/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/screenshotone/tssdk/actions/workflows/build.yml)
3
+ [![Build](https://github.com/screenshotone/jssdk/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/screenshotone/jssdk/actions/workflows/build.yml)
4
+ [![NPM package](https://img.shields.io/npm/v/screenshotone-api-sdk.svg?branch=main)](https://www.npmjs.com/package/screenshotone-api-sdk)
4
5
 
5
6
  An official [Screenshot API](https://screenshotone.com/) client for JavaScript and TypeScript.
6
7
 
@@ -9,26 +10,37 @@ It takes minutes to start taking screenshots. Just [sign up](https://screenshoto
9
10
  ## Installation
10
11
 
11
12
  ```shell
12
-
13
+ npm install screenshotone-api-sdk --save
13
14
  ```
14
15
 
15
16
  ## Usage
16
17
 
17
- Import the library:
18
- ```go
19
-
20
- ```
21
-
22
- Generate a screenshot URL without executing request:
23
- ```go
24
-
25
- ```
26
-
27
- Take a screenshot and save the image in the file:
28
- ```go
29
-
18
+ Generate a screenshot URL without executing the request. Or download the screenshot. It is up to you:
19
+ ```javascript
20
+ import * as fs from 'fs';
21
+ import * as screenshotone from 'screenshotone-api-sdk';
22
+
23
+ // create API client
24
+ const client = new screenshotone.Client("<access key>", "<secret key>");
25
+
26
+ // set up options
27
+ const options = screenshotone.TakeOptions
28
+ .url("https://example.com")
29
+ .delay(3)
30
+ .blockAds(true);
31
+
32
+ // generate URL
33
+ const url = client.generateTakeURL(options);
34
+ console.log(url);
35
+ // expected output: https://api.screenshotone.com/take?url=https%3A%2F%2Fexample.com&delay=3&block_ads=true&access_key=%3Caccess+key%3E&signature=7f3419ece2c53ed2c7923c7d5deef290d662c3643822bf69ec8259ce10b3ea61
36
+
37
+ // or download the screenshot
38
+ const imageBlob = await client.take(options);
39
+ const buffer = Buffer.from(await imageBlob.arrayBuffer());
40
+ fs.writeFileSync("example.png", buffer)
41
+ // the screenshot is store in the example.png file
30
42
  ```
31
43
 
32
44
  ## License
33
45
 
34
- `screenshotone/tssdk` is released under [the MIT license](LICENSE).
46
+ `screenshotone/jssdk` is released under [the MIT license](LICENSE).
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "screenshotone-api-sdk",
3
3
  "homepage": "https://screenshotone.com",
4
- "version": "1.0.17",
4
+ "version": "1.0.18",
5
5
  "description": "Use ScreenshotOne.com API to generate screenshots of any website.",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/screenshotone/tssdk.git"
8
+ "url": "git+https://github.com/screenshotone/jssdk.git"
9
9
  },
10
10
  "keywords": [
11
11
  "screenshot",
@@ -25,7 +25,7 @@
25
25
  "license": "MIT",
26
26
  "bugs": {
27
27
  "email": "support@screenshotone.com",
28
- "url": "https://github.com/screenshotone/tssdk/issues"
28
+ "url": "https://github.com/screenshotone/jssdk/issues"
29
29
  },
30
30
  "main": "dist/main.js",
31
31
  "types": "dist/@types/main.d.ts",