summaryrefslogtreecommitdiff
path: root/content/docs/configuration/output.md
blob: 247086574deb4640ce91d7d5240b66711d538627 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: 'Output File and Format'
weight: 10
---

The output file and format are specified in the configuration object of your scraping script. They determine where the scraped data will be saved and in what format.

## Output File

The output file is the file where the scraped data will be saved. If not specified, the data will be printed to the standard output (stdout).

```javascript {filename="Configuration"}
export const config = {
    output: {
        // Specify the output file.
        file: "results.json",
    },
};
```

In the above example, the scraped data will be saved in a file named `results.json`.

## Output Format

The output format is the format in which the scraped data will be saved. The options are `json` and `ndjson`.

```javascript {filename="Configuration"}
export const config = {
    output: {
        // Specify the output format.
        format: "json",
    },
};
```

In the above example, the scraped data will be saved in JSON format.

```javascript {filename="Configuration"}
export const config = {
    output: {
        // Specify the output format.
        format: "ndjson",
    },
};
```

In this example, the scraped data will be saved in newline-delimited JSON (NDJSON) format. Each line in the output file will be a separate JSON object.