forked from shioju/crawlee-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serialization.d.ts
32 lines (32 loc) · 1.61 KB
/
serialization.d.ts
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
import { Readable } from 'stream';
/**
* Uses Gzip compression to take an array of values, which can be anything
* from entries in a Dataset to Requests in a RequestList and compresses
* them to a Buffer in a memory-efficient way (streaming one by one). Ideally,
* the largest chunk of memory consumed will be the final compressed Buffer.
* This could be further improved by outputting a Stream, if and when
* apify-client supports streams.
* @internal
*/
export declare function serializeArray<T>(data: T[]): Promise<Buffer>;
/**
* Decompresses a Buffer previously created with compressData (technically,
* any JSON that is an Array) and collects it into an Array of values
* in a memory-efficient way (streaming the array items one by one instead
* of creating a fully decompressed buffer -> full JSON -> full Array all
* in memory at once. Could be further optimized to ingest a Stream if and
* when apify-client supports streams.
* @internal
*/
export declare function deserializeArray<T extends string | Buffer>(compressedData: Buffer): Promise<T[]>;
/**
* Creates a stream that decompresses a Buffer previously created with
* compressData (technically, any JSON that is an Array) and collects it
* into an Array of values in a memory-efficient way (streaming the array
* items one by one instead of creating a fully decompressed buffer
* -> full JSON -> full Array all in memory at once. Could be further
* optimized to ingest a Stream if and when apify-client supports streams.
* @internal
*/
export declare function createDeserialize(compressedData: Buffer): Readable;
//# sourceMappingURL=serialization.d.ts.map