1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "conversions": [
12 {
13 "value": 16,
14 "fromUnit": "px",
15 "label": "Body font size"
16 },
17 {
18 "value": 1.5,
19 "fromUnit": "rem",
20 "label": "H2 heading"
21 },
22 {
23 "value": 100,
24 "fromUnit": "vh",
25 "label": "Full-screen height"
26 },
27 {
28 "value": 72,
29 "fromUnit": "pt",
30 "label": "Print heading"
31 }
32 ],
33 "baseFontSizePx": 16,
34 "contextFontSizePx": 16,
35 "viewportWidthPx": 1440,
36 "viewportHeightPx": 900,
37 "targetUnits": [],
38 "precision": 4
39};
40
41
42const run = await client.actor("automation-lab/css-unit-converter").call(input);
43
44
45console.log('Results from dataset');
46console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
47const { items } = await client.dataset(run.defaultDatasetId).listItems();
48items.forEach((item) => {
49 console.dir(item);
50});
51
52