Range-request tokenizer adapter
npm install @tokenizer/range




shell script
npm install @tokenizer/range
`
or using yarn:
`shell script
yarn add @tokenizer/range
`
Usage
`js
(async () => {
const config = {
avoidHeadRequests: false
};
let rangeRequestClient; // HTTP implementation, or HTTP cloud access adaptor
const tokenizer = await rangeRequestTokenizer.tokenizer(rangeRequestClient, config);
})();
`
Range-request-client
The IRangeRequestClient defines the interface to map, presumably an HTTP client, to the range request mechanism.
`ts
/**
* Implementation of the range-request-client
*/
export interface IRangeRequestClient {
/**
* Head request to determine the size and MIME-type of the file
* @return HEAD-request information
*/
getHeadInfo?(): Promise;
/**
*
* @param method - HTTP method
* @param range - Array of 2 numbers: The range-start and range-end. An integer indicating the beginning and the end of range request in bytes.
* @return Range request response
*/
getResponse(method: string, range?: [number, number]): Promise;
}
`
For further details of the interface see: lib/types.ts
Example implementations of the IRangeRequestClient` interface: