@@ -3,7 +3,78 @@ import { ParseConfig, ParseResult, Parser } from 'papaparse';
33// 5.3 => https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/papaparse/index.d.ts
44// 5.2 => https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d3737ebd9125505f7ea237b9f17f1426579a3917/types/papaparse/index.d.ts
55
6- export interface CustomConfig < T = any , TInput = undefined >
6+ export interface CSVReaderConfig < T = any , TInput = undefined >
7+ extends ParseConfig < T , TInput > {
8+ /**
9+ * * * * * * * * * *
10+ * ParseAsyncConfig
11+ * * * * * * * * * *
12+ */
13+
14+ /**
15+ * Whether or not to use a worker thread.
16+ * Using a worker will keep your page reactive, but may be slightly slower.
17+ * @default false
18+ */
19+ worker ?: boolean | undefined ;
20+ /**
21+ * Overrides `Papa.LocalChunkSize` and `Papa.RemoteChunkSize`.
22+ */
23+ chunkSize ?: number | undefined ;
24+ /**
25+ * A callback function, identical to `step`, which activates streaming.
26+ * However, this function is executed after every chunk of the file is loaded and parsed rather than every row.
27+ * Works only with local and remote files.
28+ * Do not use both `chunk` and `step` callbacks together.
29+ */
30+ chunk ?( results : ParseResult < T > , parser : Parser ) : void ;
31+ /**
32+ * A callback to execute if FileReader encounters an error.
33+ * The function is passed two arguments: the error and the File.
34+ */
35+ error ?( error : Error , file : TInput ) : void ;
36+
37+ // ParseLocalConfig
38+ /** The encoding to use when opening local files. If specified, it must be a value supported by the FileReader API. */
39+ encoding ?: string | undefined ;
40+
41+ /**
42+ * * * * * * * * * * *
43+ * ParseRemoteConfig
44+ * * * * * * * * * * *
45+ */
46+
47+ /**
48+ * This indicates that the string you passed as the first argument to `parse()`
49+ * is actually a URL from which to download a file and parse its contents.
50+ */
51+ // download: true;
52+ download ?: boolean | true ; // default: false
53+ /**
54+ * If defined, should be an object that describes the headers.
55+ * @example { 'Authorization': 'token 123345678901234567890' }
56+ * @default undefined
57+ */
58+ downloadRequestHeaders ?: { [ headerName : string ] : string } | undefined ;
59+ /**
60+ * Use POST request on the URL of the download option. The value passed will be set as the body of the request.
61+ * @default undefined
62+ */
63+ downloadRequestBody ?:
64+ | Blob
65+ | BufferSource
66+ | FormData
67+ | URLSearchParams
68+ | string
69+ | undefined ;
70+ /**
71+ * A boolean value passed directly into XMLHttpRequest's "withCredentials" property.
72+ * @default undefined
73+ */
74+ withCredentials ?: boolean | undefined ;
75+ }
76+
77+ export interface ReadStringConfig < T = any , TInput = undefined >
778 extends ParseConfig < T , TInput > {
879 /**
980 * * * * * * * * * *
0 commit comments