trainDictionary
trainDictionary(
samples,options?):Promise<Uint8Array<ArrayBuffer>>
Defined in: next/api.d.ts:373
Train a zstd dictionary from samples, small pieces of data like those
that it will compress. zstd recommends about 100 times as many bytes of
samples as the size of the dictionary.
The samples are copied when trainDictionary() is called. In Node.js, the dictionary is trained on a thread of the libuv pool. The browser build trains it on the calling thread, which it blocks, before trainDictionary() returns. An AbortOptions.signal withdraws the call.
Parameters
Section titled “Parameters”samples
Section titled “samples”Iterable<Input>
options?
Section titled “options?”TrainDictionaryOptions & AbortOptions
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBuffer>>
A Promise of the dictionary, which rejects on every error, invalid
arguments included, with an ErrorCode as code, or with the
reason of the signal once it aborts: training fails with
ERR_COMPRS_OPERATION_FAILED without samples or from too little data.
trainDictionary() itself never throws.