{"id":13528313,"url":"https://github.com/Borewit/tokenizer-range","last_synced_at":"2025-04-01T11:31:28.941Z","repository":{"id":38361319,"uuid":"224042313","full_name":"Borewit/tokenizer-range","owner":"Borewit","description":"Range-request tokenizer adapter","archived":false,"fork":false,"pushed_at":"2025-03-17T13:12:24.000Z","size":11347,"stargazers_count":3,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T00:11:15.506Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Borewit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Borewit","buy_me_a_coffee":"borewit"}},"created_at":"2019-11-25T21:11:26.000Z","updated_at":"2025-02-10T16:08:13.000Z","dependencies_parsed_at":"2024-06-19T00:18:13.693Z","dependency_job_id":"4d62221f-3a2f-4e96-91ff-6821eafcb4b8","html_url":"https://github.com/Borewit/tokenizer-range","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Borewit%2Ftokenizer-range","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Borewit%2Ftokenizer-range/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Borewit%2Ftokenizer-range/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Borewit%2Ftokenizer-range/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Borewit","download_url":"https://codeload.github.com/Borewit/tokenizer-range/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246631928,"owners_count":20808782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:02:25.276Z","updated_at":"2025-04-01T11:31:24.800Z","avatar_url":"https://github.com/Borewit.png","language":"TypeScript","funding_links":["https://github.com/sponsors/Borewit","https://buymeacoffee.com/borewit"],"categories":["TypeScript"],"sub_categories":[],"readme":"[![Node.js CI](https://github.com/Borewit/tokenizer-range/actions/workflows/nodejs-ci.yml/badge.svg?branch=master)](https://github.com/Borewit/tokenizer-range/actions/workflows/nodejs-ci.yml)\n[![CodeQL](https://github.com/Borewit/tokenizer-range/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/Borewit/tokenizer-range/actions/workflows/codeql.yml)\n[![NPM version](https://badge.fury.io/js/%40tokenizer%2Frange.svg)](https://badge.fury.io/js/%40tokenizer%2Frange)\n[![npm downloads](http://img.shields.io/npm/dm/@tokenizer/range.svg)](https://npmcharts.com/compare/@tokenizer/range?interval=30)\n[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/tokenizer-range/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/tokenizer-range?targetFile=package.json)\n\n# @tokenizer/range\n\nAdapter to designed to convert [strtok3 _tokenizer_](https://github.com/Borewit/strtok3#tokenizer) to [RFC-7233](https://tools.ietf.org/html/rfc7233#section-2.3) [range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests).\n\nIt is an **abstract** module which implements the range request mechanism which can be used by different implementations, like:\n* [@tokenizer/http](https://github.com/Borewit/tokenizer-http): An HTTP(S) client\n* [@tokenizer/s3](https://github.com/Borewit/tokenizer-s3): An Amazon S3 client\n\n## Compatibility\nThis module can be used both in the browser and in [Node.js](https://nodejs.org).\n\n## Installation\n\nInstall using [npm](https://www.npmjs.com/get-npm):\n```shell script\nnpm install @tokenizer/range\n```\n\nor using [yarn](https://yarnpkg.com/):\n```shell script\nyarn add @tokenizer/range\n```\n\n## Usage\n\n```js\n(async () =\u003e {\n  const config = {\n    avoidHeadRequests: false\n  };\n\n  let rangeRequestClient; // HTTP implementation, or HTTP cloud access adaptor\n\n  const tokenizer = await rangeRequestTokenizer.tokenizer(rangeRequestClient, config);\n})();\n```\n\n## Range-request-client\n\nThe `IRangeRequestClient` defines the interface to map, presumably an HTTP client, to the range request mechanism.\n\n```ts\n/**\n * Implementation of the range-request-client\n */\nexport interface IRangeRequestClient {\n\n  /**\n   * Head request to determine the size and MIME-type of the file\n   * @return HEAD-request information\n   */\n  getHeadInfo?(): Promise\u003cIHeadRequestInfo\u003e;\n\n  /**\n   *\n   * @param method - HTTP method\n   * @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.\n   * @return Range request response\n   */\n  getResponse(method: string, range?: [number, number]): Promise\u003cIRangeRequestResponse\u003e;\n}\n```\n\nFor further details of the interface see: [lib/types.ts](lib/types.ts)\n\nExample implementations of the `IRangeRequestClient` interface:\n* [@tokenizer/s3](https://github.com/Borewit/tokenizer-s3/blob/master/lib/s3-request.ts)\n* [@tokenizer/http](https://github.com/Borewit/tokenizer-http/blob/master/lib/http-client.ts)\n\n## Licence\n\n(The MIT License)\n\nCopyright (c) 2018 Borewit\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\ngit pull\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBorewit%2Ftokenizer-range","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBorewit%2Ftokenizer-range","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBorewit%2Ftokenizer-range/lists"}