@leogps/file-uploader 2.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/.eslintrc.js +178 -0
- package/LICENSE +21 -0
- package/README.md +115 -0
- package/dist/client/1551f4f60c37af51121f.woff2 +0 -0
- package/dist/client/2285773e6b4b172f07d9.woff +0 -0
- package/dist/client/23f19bb08961f37aaf69.eot +0 -0
- package/dist/client/2f517e09eb2ca6650ff5.svg +3717 -0
- package/dist/client/4689f52cc96215721344.svg +801 -0
- package/dist/client/491974d108fe4002b2aa.ttf +0 -0
- package/dist/client/527940b104eb2ea366c8.ttf +0 -0
- package/dist/client/77206a6bb316fa0aded5.eot +0 -0
- package/dist/client/7a3337626410ca2f4071.woff2 +0 -0
- package/dist/client/7a8b4f130182d19a2d7c.svg +5034 -0
- package/dist/client/9bbb245e67a133f6e486.eot +0 -0
- package/dist/client/bb58e57c48a3e911f15f.woff +0 -0
- package/dist/client/be9ee23c0c6390141475.ttf +0 -0
- package/dist/client/d878b0a6a1144760244f.woff2 +0 -0
- package/dist/client/eeccf4f66002c6f2ba24.woff +0 -0
- package/dist/client/favicon.ico +0 -0
- package/dist/client/index.html +1 -0
- package/dist/client/main.66a16cbe5e2ce036e9a7.bundle.js +39507 -0
- package/dist/client/main.6db272040eaab1c51019.css +14 -0
- package/dist/index.js +3 -0
- package/dist/index.js.LICENSE.txt +273 -0
- package/package-gzip.js +30 -0
- package/package.json +107 -0
- package/src/globals.ts +23 -0
- package/src/index.ts +87 -0
- package/src/model/progress.ts +175 -0
- package/src/model/progress_utils.ts +17 -0
- package/src/routes/uploadChunk.ts +125 -0
- package/src/routes/uploadComplete.ts +53 -0
- package/src/routes/uploadInit.ts +83 -0
- package/src/routes/uploadStatus.ts +137 -0
- package/src/service/progress_writer.ts +52 -0
- package/src-client/entrypoint.ts +273 -0
- package/src-client/progress-handler.ts +233 -0
- package/src-client/public/favicon.ico +0 -0
- package/src-client/public/index.html +67 -0
- package/src-client/sha1.ts +19 -0
- package/src-client/style.scss +87 -0
- package/tsconfig.json +107 -0
- package/webpack-client.common.js +29 -0
- package/webpack-client.dev.js +51 -0
- package/webpack-client.prod.js +65 -0
- package/webpack.config.js +41 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/*
|
|
2
|
+
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
|
|
3
|
+
https://github.com/typescript-eslint/tslint-to-eslint-config
|
|
4
|
+
|
|
5
|
+
It represents the closest reasonable ESLint configuration to this
|
|
6
|
+
project's original TSLint configuration.
|
|
7
|
+
|
|
8
|
+
We recommend eventually switching this configuration to extend from
|
|
9
|
+
the recommended rulesets in typescript-eslint.
|
|
10
|
+
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
|
|
11
|
+
|
|
12
|
+
Happy linting! 💖
|
|
13
|
+
*/
|
|
14
|
+
import jsdoc from 'eslint-plugin-jsdoc';
|
|
15
|
+
import preferArrow from 'eslint-plugin-prefer-arrow';
|
|
16
|
+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
17
|
+
import typescriptParser from '@typescript-eslint/parser';
|
|
18
|
+
|
|
19
|
+
export default [
|
|
20
|
+
{
|
|
21
|
+
files: ['**/*.ts'],
|
|
22
|
+
languageOptions: {
|
|
23
|
+
globals: {
|
|
24
|
+
browser: true,
|
|
25
|
+
es6: true
|
|
26
|
+
},
|
|
27
|
+
parser: typescriptParser,
|
|
28
|
+
parserOptions: {
|
|
29
|
+
project: 'tsconfig.json',
|
|
30
|
+
sourceType: 'module'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
plugins: {
|
|
34
|
+
jsdoc,
|
|
35
|
+
'prefer-arrow': preferArrow,
|
|
36
|
+
'@typescript-eslint': typescriptEslint
|
|
37
|
+
},
|
|
38
|
+
"rules": {
|
|
39
|
+
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
40
|
+
"@typescript-eslint/array-type": [
|
|
41
|
+
"error",
|
|
42
|
+
{
|
|
43
|
+
"default": "array"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"@typescript-eslint/await-thenable": "error",
|
|
47
|
+
"@typescript-eslint/ban-ts-comment": "error",
|
|
48
|
+
"@typescript-eslint/consistent-type-assertions": "error",
|
|
49
|
+
"@typescript-eslint/dot-notation": "error",
|
|
50
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
51
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
52
|
+
"@typescript-eslint/no-array-constructor": "error",
|
|
53
|
+
"@typescript-eslint/no-empty-function": "error",
|
|
54
|
+
"@typescript-eslint/no-empty-interface": "error",
|
|
55
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
56
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
57
|
+
"@typescript-eslint/no-floating-promises": "warn",
|
|
58
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
59
|
+
"@typescript-eslint/no-implied-eval": "error",
|
|
60
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
61
|
+
"@typescript-eslint/no-loss-of-precision": "error",
|
|
62
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
63
|
+
"@typescript-eslint/no-misused-promises": "error",
|
|
64
|
+
"@typescript-eslint/no-namespace": "error",
|
|
65
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
66
|
+
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
67
|
+
"@typescript-eslint/no-parameter-properties": "off",
|
|
68
|
+
"@typescript-eslint/no-shadow": [
|
|
69
|
+
"error",
|
|
70
|
+
{
|
|
71
|
+
"hoist": "all"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"@typescript-eslint/no-this-alias": "error",
|
|
75
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
76
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
77
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
78
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
79
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
80
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
81
|
+
"@typescript-eslint/no-unsafe-return": "error",
|
|
82
|
+
"@typescript-eslint/no-unused-expressions": "error",
|
|
83
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
84
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
85
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
86
|
+
"@typescript-eslint/prefer-as-const": "error",
|
|
87
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
88
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
89
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
90
|
+
"@typescript-eslint/require-await": "error",
|
|
91
|
+
"@typescript-eslint/restrict-plus-operands": "off",
|
|
92
|
+
"@typescript-eslint/restrict-template-expressions": "error",
|
|
93
|
+
"@typescript-eslint/triple-slash-reference": [
|
|
94
|
+
"error",
|
|
95
|
+
{
|
|
96
|
+
"path": "always",
|
|
97
|
+
"types": "prefer-import",
|
|
98
|
+
"lib": "always"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"@typescript-eslint/typedef": "off",
|
|
102
|
+
"@typescript-eslint/unbound-method": "error",
|
|
103
|
+
"@typescript-eslint/unified-signatures": "error",
|
|
104
|
+
"complexity": "off",
|
|
105
|
+
"constructor-super": "error",
|
|
106
|
+
"dot-notation": "off",
|
|
107
|
+
"eqeqeq": [
|
|
108
|
+
"error",
|
|
109
|
+
"smart"
|
|
110
|
+
],
|
|
111
|
+
"guard-for-in": "error",
|
|
112
|
+
"id-denylist": [
|
|
113
|
+
"error",
|
|
114
|
+
"any",
|
|
115
|
+
"Number",
|
|
116
|
+
"number",
|
|
117
|
+
"String",
|
|
118
|
+
"string",
|
|
119
|
+
"Boolean",
|
|
120
|
+
"boolean",
|
|
121
|
+
"Undefined",
|
|
122
|
+
"undefined"
|
|
123
|
+
],
|
|
124
|
+
"id-match": "error",
|
|
125
|
+
"jsdoc/check-alignment": "error",
|
|
126
|
+
"jsdoc/check-indentation": "error",
|
|
127
|
+
"max-classes-per-file": [
|
|
128
|
+
"error",
|
|
129
|
+
1
|
|
130
|
+
],
|
|
131
|
+
"new-parens": "error",
|
|
132
|
+
"no-array-constructor": "off",
|
|
133
|
+
"no-bitwise": "error",
|
|
134
|
+
"no-caller": "error",
|
|
135
|
+
"no-cond-assign": "error",
|
|
136
|
+
"no-console": "off",
|
|
137
|
+
"no-debugger": "error",
|
|
138
|
+
"no-empty": "error",
|
|
139
|
+
"no-empty-function": "error",
|
|
140
|
+
"no-eval": "error",
|
|
141
|
+
"no-fallthrough": "off",
|
|
142
|
+
"no-implied-eval": "off",
|
|
143
|
+
"no-invalid-this": "off",
|
|
144
|
+
"no-loss-of-precision": "off",
|
|
145
|
+
"no-new-wrappers": "error",
|
|
146
|
+
"no-shadow": "off",
|
|
147
|
+
"no-throw-literal": "error",
|
|
148
|
+
"no-trailing-spaces": "error",
|
|
149
|
+
"no-undef-init": "error",
|
|
150
|
+
"no-underscore-dangle": "off",
|
|
151
|
+
"no-unsafe-finally": "error",
|
|
152
|
+
"no-unused-expressions": "off",
|
|
153
|
+
"no-unused-labels": "error",
|
|
154
|
+
"no-unused-vars": "off",
|
|
155
|
+
"no-use-before-define": "off",
|
|
156
|
+
"no-var": "error",
|
|
157
|
+
"object-shorthand": "error",
|
|
158
|
+
"one-var": [
|
|
159
|
+
"error",
|
|
160
|
+
"never"
|
|
161
|
+
],
|
|
162
|
+
"prefer-arrow/prefer-arrow-functions": "error",
|
|
163
|
+
"prefer-const": "error",
|
|
164
|
+
"radix": "error",
|
|
165
|
+
"require-await": "off",
|
|
166
|
+
"spaced-comment": [
|
|
167
|
+
"error",
|
|
168
|
+
"always",
|
|
169
|
+
{
|
|
170
|
+
"markers": [
|
|
171
|
+
"/"
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
"use-isnan": "error",
|
|
176
|
+
"valid-typeof": "off"
|
|
177
|
+
}
|
|
178
|
+
}];
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 leogps
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# File-Uploader Server
|
|
2
|
+
|
|
3
|
+
Zero-config command-line tool to run a file-uploader server. Files can be uploaded typically from a browser.
|
|
4
|
+
|
|
5
|
+
Both Server and Client are written in JS.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
* [Run](#run-in-production-mode)
|
|
10
|
+
* [Clean](#clean)
|
|
11
|
+
* [Build](#build-prod)
|
|
12
|
+
* [Serve](#serve-prod)
|
|
13
|
+
* [Configuration Options](#configuration-options)
|
|
14
|
+
* [Run in Development Mode](#run-in-development-mode)
|
|
15
|
+
* [Complete list of commands](#complete-list-of-commands-bunnpm)
|
|
16
|
+
|
|
17
|
+
## Run in Production Mode
|
|
18
|
+
|
|
19
|
+
### Clean
|
|
20
|
+
|
|
21
|
+
npm run clean # or bun run clean (optional)
|
|
22
|
+
|
|
23
|
+
### Build (Prod)
|
|
24
|
+
|
|
25
|
+
npm run build-prod # or bun run build-prod
|
|
26
|
+
|
|
27
|
+
### Serve (Prod)
|
|
28
|
+
|
|
29
|
+
node dist/ # or bun run ./dist/
|
|
30
|
+
|
|
31
|
+
### Configuration Options
|
|
32
|
+
|
|
33
|
+
--version Show version number [boolean]
|
|
34
|
+
-l, --upload_location upload location
|
|
35
|
+
[string] [default: "/Users/username/Downloads/uploads/"]
|
|
36
|
+
-p, --port server port [number]
|
|
37
|
+
--help Show help [boolean]
|
|
38
|
+
|
|
39
|
+
## Run in Development Mode
|
|
40
|
+
|
|
41
|
+
npm run start # or bun start
|
|
42
|
+
|
|
43
|
+
## Complete list of commands (bun|npm)
|
|
44
|
+
|
|
45
|
+
* `bun|npm run clean`
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
rimraf dist
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
* `bun|npm run precompile`
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
eslint -c .eslintrc.js --fix --ext .ts src src-client
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
* `bun|npm run compile-server`
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
./node_modules/webpack-cli/bin/cli.js --config webpack.config.js
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
* `bun|npm run compile-client-dev`
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
./node_modules/webpack-cli/bin/cli.js --config webpack-client.dev.js
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
* `bun|npm run compile-client-prod`
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
./node_modules/webpack-cli/bin/cli.js --config webpack-client.prod.js
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
* `bun|npm run compile-dev`
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm run precompile && npm run compile-server && npm run compile-client-dev
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
* `bun|npm run build-dev`
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm run compile-dev
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
* `bun|npm run compile-prod`
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm run precompile && npm run compile-server && npm run compile-client-prod
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
* `bun|npm run build-prod`
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npm run compile-prod
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
* `bun|npm run dev:server`
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npm run build:server:once && npm-run-all --parallel nodemon:prod watch:client
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
* `bun|npm run start`
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm run build-dev && node dist/index.js
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
* `bun|npm run package`
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
cross-env NODE_ENV=production npm run build-prod && node ./package-gzip.js
|
|
115
|
+
```
|
|
Binary file
|
|
Binary file
|
|
Binary file
|