Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tokenizer/range

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tokenizer/range - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

5

lib/chunked-file-data.d.ts

@@ -5,2 +5,7 @@ export interface IChunk {

}
export interface IChunkRange {
startIx: number;
endIx: number;
insertIx?: number;
}
/**

@@ -7,0 +12,0 @@ * Keeps track of data chunks (partial downloaded file fragments).

3

lib/index.d.ts
import type { IRangeRequestClient, IRangeRequestConfig } from './types.js';
import { type ITokenizer } from 'strtok3';
import type { ITokenizer } from 'strtok3';
export type { IRangeRequestClient, IRangeRequestResponse, IContentRangeType, IHeadRequestInfo, IRangeRequestConfig } from './types.js';

@@ -8,2 +8,3 @@ export { parseContentRange } from './range-request-tokenizer.js';

* @param rangeRequestClient - HTTP range request client
* @param abortController - AbortController
* @param config - Configuration

@@ -10,0 +11,0 @@ * @return Tokenizer

@@ -6,2 +6,3 @@ import { RangeRequestFactory } from './range-request-factory.js';

* @param rangeRequestClient - HTTP range request client
* @param abortController - AbortController
* @param config - Configuration

@@ -8,0 +9,0 @@ * @return Tokenizer

@@ -13,4 +13,5 @@ import { AbstractTokenizer, type IReadChunkOptions } from 'strtok3';

private minimumChunkSize;
private abortController?;
private _fileData;
constructor(rangeRequestClient: IRangeRequestClient, fileInfo: IHeadRequestInfo, minimumChunkSize: number);
constructor(rangeRequestClient: IRangeRequestClient, fileInfo: IHeadRequestInfo, minimumChunkSize: number, abortController?: AbortController | undefined);
/**

@@ -36,2 +37,3 @@ * Read portion from stream

ignore(length: number): Promise<number>;
abort(): Promise<void>;
private loadRange;

@@ -44,2 +46,2 @@ }

*/
export declare function parseContentRange(contentRange: string | null): IContentRangeType;
export declare function parseContentRange(contentRange: string): IContentRangeType;

@@ -13,7 +13,8 @@ import { AbstractTokenizer } from 'strtok3';

export class RangeRequestTokenizer extends AbstractTokenizer {
constructor(rangeRequestClient, fileInfo, minimumChunkSize) {
constructor(rangeRequestClient, fileInfo, minimumChunkSize, abortController) {
super({ fileInfo });
this.rangeRequestClient = rangeRequestClient;
this.minimumChunkSize = minimumChunkSize;
if (isNaN(minimumChunkSize)) {
this.abortController = abortController;
if (Number.isNaN(minimumChunkSize)) {
throw new Error('minimumChunkSize must be a number');

@@ -30,3 +31,3 @@ }

async readBuffer(uint8array, options) {
if (options && options.position) {
if (options?.position) {
this.position = options.position;

@@ -88,2 +89,5 @@ }

}
async abort() {
this.abortController?.abort();
}
async loadRange(range) {

@@ -128,13 +132,13 @@ if (range[0] > (this.fileInfo.size - 1)) {

}
debug(`_parseContentRang response: contentRange=${contentRange}`);
debug(`parseContentRange response: contentRange=${contentRange}`);
const parsedContentRange = contentRange.match(/bytes (\d+)-(\d+)\/(?:(\d+)|\*)/i);
if (!parsedContentRange) {
throw new Error('FIXME: Unknown Content-Range syntax: ' + contentRange);
throw new Error(`FIXME: Unknown Content-Range syntax: ${contentRange}`);
}
return {
firstBytePosition: parseInt(parsedContentRange[1], 10),
lastBytePosition: parseInt(parsedContentRange[2], 10),
instanceLength: parsedContentRange[3] ? parseInt(parsedContentRange[3], 10) : undefined
firstBytePosition: Number.parseInt(parsedContentRange[1], 10),
lastBytePosition: Number.parseInt(parsedContentRange[2], 10),
instanceLength: parsedContentRange[3] ? Number.parseInt(parsedContentRange[3], 10) : undefined
};
}
//# sourceMappingURL=range-request-tokenizer.js.map
import type { IFileInfo } from 'strtok3';
export interface IRangeRequestConfig {
abortController?: AbortController;
timeoutInSec?: number;

@@ -4,0 +5,0 @@ avoidHeadRequests?: boolean;

{
"name": "@tokenizer/range",
"version": "0.8.0",
"version": "0.9.0",
"description": "Range-request tokenizer adapter",

@@ -49,44 +49,35 @@ "type": "module",

"scripts": {
"clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts test/**/*.js test/**/*.js.map coverage",
"clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'test/**/*.js' 'test/**/*.js.map' coverage",
"compile-lib": "tsc -p lib/tsconfig.json",
"compile-test": "tsc -p test/tsconfig.json",
"compile": "npm run compile-lib && yarn run compile-test",
"compile": "yarn run compile-lib && yarn run compile-test",
"prepublishOnly": "yarn run build",
"build": "npm run clean && yarn run compile",
"eslint": "eslint lib test",
"lint": "npx eslint",
"build": "yarn run clean && yarn run compile",
"lint-ts": "biome check",
"lint": "yarn run lint-ts",
"test": "mocha",
"test-node": "cd node && yarn install && yarn test-data",
"test-coverage": "c8 npm run test",
"test-coverage": "c8 yarn run test",
"send-codacy": "c8 report --reporter=text-lcov | codacy-coverage"
},
"devDependencies": {
"@eslint/compat": "^1.1.1",
"@types/chai": "^4.3.16",
"@biomejs/biome": "^1.8.3",
"@types/chai": "^4.3.19",
"@types/debug": "^4.1.12",
"@types/mocha": "^10.0.7",
"@types/node": "^20.14.11",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"@types/node": "^22.5.2",
"c8": "^10.1.2",
"chai": "^5.1.1",
"del-cli": "^5.1.0",
"eslint": "^9.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.8.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-unicorn": "^54.0.0",
"global": "^4.4.0",
"mocha": "^10.7.0",
"music-metadata": "^10.0.0",
"mocha": "^10.7.3",
"music-metadata": "^10.3.1",
"ts-node": "^10.9.2",
"typescript": "^5.5.3"
"typescript": "^5.5.4"
},
"dependencies": {
"debug": "^4.3.5",
"strtok3": "^8.0.1"
"debug": "^4.3.6",
"strtok3": "^9.0.0"
},
"packageManager": "yarn@4.3.1"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc