strtok3 7.0.0-alpha.7 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/types.d.ts CHANGED
@@ -1,103 +1,103 @@
1
- /// <reference types="node" />
2
- import { IGetToken } from '@tokenizer/token';
3
- export interface IFileInfo {
4
- /**
5
- * File size in bytes
6
- */
7
- size?: number;
8
- /**
9
- * MIME-type of file
10
- */
11
- mimeType?: string;
12
- /**
13
- * File path
14
- */
15
- path?: string;
16
- /**
17
- * File URL
18
- */
19
- url?: string;
20
- }
21
- export interface IReadChunkOptions {
22
- /**
23
- * The offset in the buffer to start writing at; default is 0
24
- */
25
- offset?: number;
26
- /**
27
- * Number of bytes to read.
28
- */
29
- length?: number;
30
- /**
31
- * Position where to begin reading from the file.
32
- * Default it is `tokenizer.position`.
33
- * Position may not be less then `tokenizer.position`.
34
- */
35
- position?: number;
36
- /**
37
- * If set, will not throw an EOF error if not all of the requested data could be read
38
- */
39
- mayBeLess?: boolean;
40
- }
41
- /**
42
- * The tokenizer allows us to read or peek from the tokenizer-stream.
43
- * The tokenizer-stream is an abstraction of a stream, file or Buffer.
44
- */
45
- export interface ITokenizer {
46
- /**
47
- * Provide access to information of the underlying information stream or file.
48
- */
49
- fileInfo: IFileInfo;
50
- /**
51
- * Offset in bytes (= number of bytes read) since beginning of file or stream
52
- */
53
- position: number;
54
- /**
55
- * Peek (read ahead) buffer from tokenizer
56
- * @param buffer - Target buffer to fill with data peek from the tokenizer-stream
57
- * @param options - Read behaviour options
58
- * @returns Promise with number of bytes read
59
- */
60
- peekBuffer(buffer: Buffer, options?: IReadChunkOptions): Promise<number>;
61
- /**
62
- * Peek (read ahead) buffer from tokenizer
63
- * @param buffer - Target buffer to fill with data peeked from the tokenizer-stream
64
- * @param options - Additional read options
65
- * @returns Promise with number of bytes read
66
- */
67
- readBuffer(buffer: Buffer, options?: IReadChunkOptions): Promise<number>;
68
- /**
69
- * Peek a token from the tokenizer-stream.
70
- * @param token - Token to peek from the tokenizer-stream.
71
- * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position.
72
- * @param maybeless - If set, will not throw an EOF error if the less then the requested length could be read.
73
- */
74
- peekToken<T>(token: IGetToken<T>, position?: number | null, maybeless?: boolean): Promise<T>;
75
- /**
76
- * Read a token from the tokenizer-stream.
77
- * @param token - Token to peek from the tokenizer-stream.
78
- * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position.
79
- */
80
- readToken<T>(token: IGetToken<T>, position?: number): Promise<T>;
81
- /**
82
- * Peek a numeric token from the stream
83
- * @param token - Numeric token
84
- * @returns Promise with number
85
- */
86
- peekNumber(token: IGetToken<number>): Promise<number>;
87
- /**
88
- * Read a numeric token from the stream
89
- * @param token - Numeric token
90
- * @returns Promise with number
91
- */
92
- readNumber(token: IGetToken<number>): Promise<number>;
93
- /**
94
- * Ignore given number of bytes
95
- * @param length - Number of bytes ignored
96
- */
97
- ignore(length: number): Promise<number>;
98
- /**
99
- * Clean up resources.
100
- * It does not close the stream for StreamReader, but is does close the file-descriptor.
101
- */
102
- close(): Promise<void>;
103
- }
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { IGetToken } from '@tokenizer/token';
3
+ export interface IFileInfo {
4
+ /**
5
+ * File size in bytes
6
+ */
7
+ size?: number;
8
+ /**
9
+ * MIME-type of file
10
+ */
11
+ mimeType?: string;
12
+ /**
13
+ * File path
14
+ */
15
+ path?: string;
16
+ /**
17
+ * File URL
18
+ */
19
+ url?: string;
20
+ }
21
+ export interface IReadChunkOptions {
22
+ /**
23
+ * The offset in the buffer to start writing at; default is 0
24
+ */
25
+ offset?: number;
26
+ /**
27
+ * Number of bytes to read.
28
+ */
29
+ length?: number;
30
+ /**
31
+ * Position where to begin reading from the file.
32
+ * Default it is `tokenizer.position`.
33
+ * Position may not be less then `tokenizer.position`.
34
+ */
35
+ position?: number;
36
+ /**
37
+ * If set, will not throw an EOF error if not all of the requested data could be read
38
+ */
39
+ mayBeLess?: boolean;
40
+ }
41
+ /**
42
+ * The tokenizer allows us to read or peek from the tokenizer-stream.
43
+ * The tokenizer-stream is an abstraction of a stream, file or Buffer.
44
+ */
45
+ export interface ITokenizer {
46
+ /**
47
+ * Provide access to information of the underlying information stream or file.
48
+ */
49
+ fileInfo: IFileInfo;
50
+ /**
51
+ * Offset in bytes (= number of bytes read) since beginning of file or stream
52
+ */
53
+ position: number;
54
+ /**
55
+ * Peek (read ahead) buffer from tokenizer
56
+ * @param buffer - Target buffer to fill with data peek from the tokenizer-stream
57
+ * @param options - Read behaviour options
58
+ * @returns Promise with number of bytes read
59
+ */
60
+ peekBuffer(buffer: Buffer, options?: IReadChunkOptions): Promise<number>;
61
+ /**
62
+ * Peek (read ahead) buffer from tokenizer
63
+ * @param buffer - Target buffer to fill with data peeked from the tokenizer-stream
64
+ * @param options - Additional read options
65
+ * @returns Promise with number of bytes read
66
+ */
67
+ readBuffer(buffer: Buffer, options?: IReadChunkOptions): Promise<number>;
68
+ /**
69
+ * Peek a token from the tokenizer-stream.
70
+ * @param token - Token to peek from the tokenizer-stream.
71
+ * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position.
72
+ * @param maybeless - If set, will not throw an EOF error if the less then the requested length could be read.
73
+ */
74
+ peekToken<T>(token: IGetToken<T>, position?: number | null, maybeless?: boolean): Promise<T>;
75
+ /**
76
+ * Read a token from the tokenizer-stream.
77
+ * @param token - Token to peek from the tokenizer-stream.
78
+ * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position.
79
+ */
80
+ readToken<T>(token: IGetToken<T>, position?: number): Promise<T>;
81
+ /**
82
+ * Peek a numeric token from the stream
83
+ * @param token - Numeric token
84
+ * @returns Promise with number
85
+ */
86
+ peekNumber(token: IGetToken<number>): Promise<number>;
87
+ /**
88
+ * Read a numeric token from the stream
89
+ * @param token - Numeric token
90
+ * @returns Promise with number
91
+ */
92
+ readNumber(token: IGetToken<number>): Promise<number>;
93
+ /**
94
+ * Ignore given number of bytes
95
+ * @param length - Number of bytes ignored
96
+ */
97
+ ignore(length: number): Promise<number>;
98
+ /**
99
+ * Clean up resources.
100
+ * It does not close the stream for StreamReader, but is does close the file-descriptor.
101
+ */
102
+ close(): Promise<void>;
103
+ }
package/lib/types.js CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/package.json CHANGED
@@ -1,95 +1,94 @@
1
- {
2
- "name": "strtok3",
3
- "version": "7.0.0-alpha.7",
4
- "description": "A promise based streaming tokenizer",
5
- "author": {
6
- "name": "Borewit",
7
- "url": "https://github.com/Borewit"
8
- },
9
- "funding": {
10
- "type": "github",
11
- "url": "https://github.com/sponsors/Borewit"
12
- },
13
- "scripts": {
14
- "clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts test/**/*.js test/**/*.js.map",
15
- "compile-src": "tsc -p lib",
16
- "compile-test": "tsc -p test",
17
- "compile": "npm run compile-src && npm run compile-test",
18
- "build": "npm run clean && npm run compile",
19
- "eslint": "eslint lib test --ext .ts --ignore-pattern *.d.ts",
20
- "lint-md": "remark -u preset-lint-recommended .",
21
- "lint": "npm run lint-md && npm run eslint",
22
- "fix": "eslint lib test --ext .ts --ignore-pattern *.d.ts --fix",
23
- "test": "mocha",
24
- "test-coverage": "c8 npm run test",
25
- "send-coveralls": "c8 report | coveralls",
26
- "send-codacy": "c8 report --reporter=text-lcov | codacy-coverage",
27
- "start": "npm run compile && npm run lint && npm run cover-test"
28
- },
29
- "engines": {
30
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
31
- },
32
- "repository": {
33
- "type": "git",
34
- "url": "https://github.com/Borewit/strtok3.git"
35
- },
36
- "license": "MIT",
37
- "main": "lib/index.js",
38
- "type": "module",
39
- "exports": {
40
- ".": {
41
- "node": "./lib/index.js",
42
- "default": "./lib/core.js"
43
- },
44
- "./core": "./lib/core.js"
45
- },
46
- "types": "lib/index.d.ts",
47
- "files": [
48
- "lib/**/*.js",
49
- "lib/**/*.d.ts"
50
- ],
51
- "bugs": {
52
- "url": "https://github.com/Borewit/strtok3/issues"
53
- },
54
- "devDependencies": {
55
- "@types/chai": "^4.3.0",
56
- "@types/debug": "^4.1.7",
57
- "@types/mocha": "^9.0.0",
58
- "@types/node": "^16.11.12",
59
- "@typescript-eslint/eslint-plugin": "^2.34.0",
60
- "@typescript-eslint/eslint-plugin-tslint": "^5.6.0",
61
- "@typescript-eslint/parser": "^2.34.0",
62
- "c8": "^7.10.0",
63
- "chai": "^4.3.4",
64
- "coveralls": "^3.1.1",
65
- "del-cli": "^4.0.1",
66
- "eslint": "^6.8.0",
67
- "eslint-plugin-import": "^2.25.3",
68
- "eslint-plugin-prefer-arrow": "^1.2.3",
69
- "mocha": "^9.1.3",
70
- "remark-cli": "^10.0.1",
71
- "remark-preset-lint-recommended": "^6.1.2",
72
- "token-types": "^4.1.1",
73
- "ts-node": "^10.4.0",
74
- "tslint": "^6.1.3",
75
- "typescript": "^4.5.3"
76
- },
77
- "dependencies": {
78
- "@tokenizer/token": "^0.3.0",
79
- "peek-readable": "^5.0.0-alpha.5"
80
- },
81
- "keywords": [
82
- "tokenizer",
83
- "reader",
84
- "token",
85
- "async",
86
- "promise",
87
- "parser",
88
- "decoder",
89
- "binary",
90
- "endian",
91
- "uint",
92
- "stream",
93
- "streaming"
94
- ]
95
- }
1
+ {
2
+ "name": "strtok3",
3
+ "version": "7.0.0",
4
+ "description": "A promise based streaming tokenizer",
5
+ "author": {
6
+ "name": "Borewit",
7
+ "url": "https://github.com/Borewit"
8
+ },
9
+ "funding": {
10
+ "type": "github",
11
+ "url": "https://github.com/sponsors/Borewit"
12
+ },
13
+ "scripts": {
14
+ "clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts test/**/*.js test/**/*.js.map",
15
+ "compile-src": "tsc -p lib",
16
+ "compile-test": "tsc -p test",
17
+ "compile": "npm run compile-src && npm run compile-test",
18
+ "build": "npm run clean && npm run compile",
19
+ "eslint": "eslint lib test --ext .ts --ignore-pattern *.d.ts",
20
+ "lint-md": "remark -u preset-lint-recommended .",
21
+ "lint": "npm run lint-md && npm run eslint",
22
+ "fix": "eslint lib test --ext .ts --ignore-pattern *.d.ts --fix",
23
+ "test": "mocha",
24
+ "test-coverage": "c8 npm run test",
25
+ "send-codacy": "c8 report --reporter=text-lcov | codacy-coverage",
26
+ "start": "npm run compile && npm run lint && npm run cover-test"
27
+ },
28
+ "engines": {
29
+ "node": ">=14.16"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/Borewit/strtok3.git"
34
+ },
35
+ "license": "MIT",
36
+ "type": "module",
37
+ "exports": {
38
+ ".": {
39
+ "node": "./lib/index.js",
40
+ "default": "./lib/core.js"
41
+ },
42
+ "./core": "./lib/core.js"
43
+ },
44
+ "types": "lib/index.d.ts",
45
+ "files": [
46
+ "lib/**/*.js",
47
+ "lib/**/*.d.ts"
48
+ ],
49
+ "bugs": {
50
+ "url": "https://github.com/Borewit/strtok3/issues"
51
+ },
52
+ "devDependencies": {
53
+ "@types/chai": "^4.3.1",
54
+ "@types/debug": "^4.1.7",
55
+ "@types/mocha": "^9.1.0",
56
+ "@types/node": "^18.6.3",
57
+ "@typescript-eslint/eslint-plugin": "^5.32.0",
58
+ "@typescript-eslint/parser": "^5.32.0",
59
+ "c8": "^7.12.0",
60
+ "chai": "^4.3.6",
61
+ "del-cli": "^5.0.0",
62
+ "eslint": "^8.21.0",
63
+ "eslint-config-prettier": "^8.5.0",
64
+ "eslint-import-resolver-typescript": "^3.4.0",
65
+ "eslint-plugin-import": "^2.26.0",
66
+ "eslint-plugin-jsdoc": "^39.3.4",
67
+ "eslint-plugin-node": "^11.1.0",
68
+ "eslint-plugin-unicorn": "^43.0.2",
69
+ "mocha": "^10.0.0",
70
+ "remark-cli": "^11.0.0",
71
+ "remark-preset-lint-recommended": "^6.1.2",
72
+ "token-types": "^5.0.0",
73
+ "ts-node": "^10.9.1",
74
+ "typescript": "^4.7.4"
75
+ },
76
+ "dependencies": {
77
+ "@tokenizer/token": "^0.3.0",
78
+ "peek-readable": "^5.0.0"
79
+ },
80
+ "keywords": [
81
+ "tokenizer",
82
+ "reader",
83
+ "token",
84
+ "async",
85
+ "promise",
86
+ "parser",
87
+ "decoder",
88
+ "binary",
89
+ "endian",
90
+ "uint",
91
+ "stream",
92
+ "streaming"
93
+ ]
94
+ }