eml-parser-qaap 1.1.16 → 1.1.18
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/README.md +10 -11
- package/dist/interface.d.ts +1 -0
- package/lib/bundle.amd.js +9 -1
- package/lib/bundle.cjs.js +9 -1
- package/lib/bundle.esm.js +9 -1
- package/lib/bundle.iife.js +9 -1
- package/lib/bundle.umd.js +9 -1
- package/package.json +119 -105
- package/src/index.ts +9 -1
- package/src/interface.ts +1 -0
package/README.md
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
# eml-parse-
|
|
2
|
-
|
|
3
|
-
# srjikMou
|
|
4
|
-
|
|
1
|
+
# eml-parse-js
|
|
5
2
|
[RFC 822](https://www.w3.org/Protocols/rfc822/) EML file format parser and builder, Can be used in browser environment
|
|
6
3
|
|
|
7
|
-
> fork from `eml-
|
|
8
|
-
|
|
9
|
-
1. fix `eml-parse-vqaap` for parsing html from the eml with `quoted-printable`
|
|
4
|
+
> fork from `eml-format-js`(used in Browser env) & `eml-format` (used in NodeJs env)
|
|
5
|
+
1. fix `eml-format-js` for parsing html from the eml with `quoted-printable`
|
|
10
6
|
2. add `data` with `base64` in attachment
|
|
11
7
|
|
|
12
8
|
## start guide
|
|
13
9
|
|
|
14
10
|
```javascript
|
|
15
|
-
import { parseEml, readEml, GBKUTF8, decode } from 'eml-parse-
|
|
11
|
+
import { parseEml, readEml, GBKUTF8, decode } from 'eml-parse-js';
|
|
16
12
|
|
|
17
13
|
// const eml = await axios(http | ajax).get()
|
|
18
|
-
// `.eml` file
|
|
19
|
-
readEml(eml, (err, ReadEmlJson) => {
|
|
14
|
+
// `.eml` file
|
|
15
|
+
readEml(eml, (err, ReadEmlJson) => {
|
|
16
|
+
|
|
17
|
+
});
|
|
20
18
|
```
|
|
21
19
|
|
|
22
20
|
## @types
|
|
23
21
|
|
|
24
22
|
```typescript
|
|
23
|
+
|
|
25
24
|
interface Attachment {
|
|
26
25
|
name: string;
|
|
27
26
|
contentType: string;
|
|
@@ -35,7 +34,7 @@ interface Attachment {
|
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
interface ReadEmlJson {
|
|
38
|
-
|
|
37
|
+
attachments: Attachment
|
|
39
38
|
date: Date | string;
|
|
40
39
|
subject: string;
|
|
41
40
|
from: EmailAddress | EmailAddress[] | null;
|
package/dist/interface.d.ts
CHANGED
package/lib/bundle.amd.js
CHANGED
|
@@ -1252,7 +1252,15 @@ define(['exports', 'js-base64', '@sinonjs/text-encoding'], function (exports, js
|
|
|
1252
1252
|
}
|
|
1253
1253
|
}
|
|
1254
1254
|
if (result_name) {
|
|
1255
|
-
attachment.name =
|
|
1255
|
+
attachment.name = result_name;
|
|
1256
|
+
if (/%[0-9A-Fa-f]{2}/.test(result_name)) {
|
|
1257
|
+
try {
|
|
1258
|
+
attachment.name = decodeURIComponent(result_name);
|
|
1259
|
+
}
|
|
1260
|
+
catch (_a) {
|
|
1261
|
+
attachment.name = result_name;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1256
1264
|
}
|
|
1257
1265
|
var ct = headers['Content-Type'] || headers['Content-type'];
|
|
1258
1266
|
if (ct) {
|
package/lib/bundle.cjs.js
CHANGED
|
@@ -1257,7 +1257,15 @@ function read(eml, options, callback) {
|
|
|
1257
1257
|
}
|
|
1258
1258
|
}
|
|
1259
1259
|
if (result_name) {
|
|
1260
|
-
attachment.name =
|
|
1260
|
+
attachment.name = result_name;
|
|
1261
|
+
if (/%[0-9A-Fa-f]{2}/.test(result_name)) {
|
|
1262
|
+
try {
|
|
1263
|
+
attachment.name = decodeURIComponent(result_name);
|
|
1264
|
+
}
|
|
1265
|
+
catch (_a) {
|
|
1266
|
+
attachment.name = result_name;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1261
1269
|
}
|
|
1262
1270
|
var ct = headers['Content-Type'] || headers['Content-type'];
|
|
1263
1271
|
if (ct) {
|
package/lib/bundle.esm.js
CHANGED
|
@@ -1254,7 +1254,15 @@ function read(eml, options, callback) {
|
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
1256
|
if (result_name) {
|
|
1257
|
-
attachment.name =
|
|
1257
|
+
attachment.name = result_name;
|
|
1258
|
+
if (/%[0-9A-Fa-f]{2}/.test(result_name)) {
|
|
1259
|
+
try {
|
|
1260
|
+
attachment.name = decodeURIComponent(result_name);
|
|
1261
|
+
}
|
|
1262
|
+
catch (_a) {
|
|
1263
|
+
attachment.name = result_name;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1258
1266
|
}
|
|
1259
1267
|
var ct = headers['Content-Type'] || headers['Content-type'];
|
|
1260
1268
|
if (ct) {
|
package/lib/bundle.iife.js
CHANGED
|
@@ -1253,7 +1253,15 @@
|
|
|
1253
1253
|
}
|
|
1254
1254
|
}
|
|
1255
1255
|
if (result_name) {
|
|
1256
|
-
attachment.name =
|
|
1256
|
+
attachment.name = result_name;
|
|
1257
|
+
if (/%[0-9A-Fa-f]{2}/.test(result_name)) {
|
|
1258
|
+
try {
|
|
1259
|
+
attachment.name = decodeURIComponent(result_name);
|
|
1260
|
+
}
|
|
1261
|
+
catch (_a) {
|
|
1262
|
+
attachment.name = result_name;
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1257
1265
|
}
|
|
1258
1266
|
var ct = headers['Content-Type'] || headers['Content-type'];
|
|
1259
1267
|
if (ct) {
|
package/lib/bundle.umd.js
CHANGED
|
@@ -1256,7 +1256,15 @@
|
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
1258
|
if (result_name) {
|
|
1259
|
-
attachment.name =
|
|
1259
|
+
attachment.name = result_name;
|
|
1260
|
+
if (/%[0-9A-Fa-f]{2}/.test(result_name)) {
|
|
1261
|
+
try {
|
|
1262
|
+
attachment.name = decodeURIComponent(result_name);
|
|
1263
|
+
}
|
|
1264
|
+
catch (_a) {
|
|
1265
|
+
attachment.name = result_name;
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1260
1268
|
}
|
|
1261
1269
|
var ct = headers['Content-Type'] || headers['Content-type'];
|
|
1262
1270
|
if (ct) {
|
package/package.json
CHANGED
|
@@ -1,107 +1,121 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
2
|
+
"name": "eml-parser-qaap",
|
|
3
|
+
"version": "1.1.18",
|
|
4
|
+
"description": "format EML file in browser env",
|
|
5
|
+
"main": "./lib/bundle.umd.js",
|
|
6
|
+
"module": "./lib/bundle.esm.js",
|
|
7
|
+
"es2015": "./lib/bundle.esm.js",
|
|
8
|
+
"esm5": "./lib/bundle.esm.js",
|
|
9
|
+
"typings": "./dist/index.d.ts",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"node": "./lib/bundle.cjs.js",
|
|
15
|
+
"require": "./lib/bundle.cjs.js",
|
|
16
|
+
"es2015": "./lib/bundle.esm.js",
|
|
17
|
+
"default": "./lib/bundle.esm.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"build:es": "tsc -p ./tsconfig.es2015.json",
|
|
23
|
+
"build:umd": "tsc -p ./tsconfig.umd.json",
|
|
24
|
+
"build:amd": "tsc -p ./tsconfig.amd.json",
|
|
25
|
+
"build:ts": "npm run clean:dist && npm run build && npm run build:es -- --declaration false && npm run build:umd -- --declaration false && npm run build:amd",
|
|
26
|
+
"build:rollup": "rollup --config",
|
|
27
|
+
"build:publish": "npm run clean:dist && npm run build && npm run build:rollup",
|
|
28
|
+
"clean:dist": "rimraf dist",
|
|
29
|
+
"eslint:init": "eslint --init",
|
|
30
|
+
"lint:ci": "eslint --ext .ts src/",
|
|
31
|
+
"lint": "eslint --fix --ext .ts src/",
|
|
32
|
+
"link:lib": "rimraf node_modules/eml-format-js && linklocal",
|
|
33
|
+
"prettier": "prettier --parser typescript --write src/*ts && npm run lint",
|
|
34
|
+
"prepublishOnly": "npm run prettier && npm run build:publish && npm run test",
|
|
35
|
+
"test": "mocha --reporter spec",
|
|
36
|
+
"ci": "npm install"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist/index.d.ts",
|
|
40
|
+
"dist/charset.d.ts",
|
|
41
|
+
"dist/utils.d.ts",
|
|
42
|
+
"dist/interface.d.ts",
|
|
43
|
+
"dist/addressparser.d.ts",
|
|
44
|
+
"src",
|
|
45
|
+
"lib",
|
|
46
|
+
"LICENSE"
|
|
47
|
+
],
|
|
48
|
+
"private": false,
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/MQpeng/eml-parse-js"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"eml",
|
|
55
|
+
"eml-parse",
|
|
56
|
+
"eml-format-js",
|
|
57
|
+
"eml-parse-js",
|
|
58
|
+
"typescript"
|
|
59
|
+
],
|
|
60
|
+
"author": "bean",
|
|
61
|
+
"license": "MIT",
|
|
62
|
+
"bugs": {
|
|
63
|
+
"url": "https://github.com/MQpeng/eml-parse-js/issues"
|
|
64
|
+
},
|
|
65
|
+
"homepage": "https://github.com/MQpeng/eml-parse-js#readme",
|
|
66
|
+
"contributors": [
|
|
67
|
+
{
|
|
68
|
+
"name": "Charlie Harding",
|
|
69
|
+
"url": "https://github.com/c-harding"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "Pádraig Weeks",
|
|
73
|
+
"url": "https://github.com/pmweeks98"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "Thomas Oeser",
|
|
77
|
+
"url": "https://github.com/thomasoeser"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "Robert Scheinpflug",
|
|
81
|
+
"url": "https://github.com/neversun"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "Bean Q",
|
|
85
|
+
"url": "https://github.com/MQpeng"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"devDependencies": {
|
|
89
|
+
"@types/node": "^17.0.21",
|
|
90
|
+
"@types/ramda": "^0.26.36",
|
|
91
|
+
"@typescript-eslint/eslint-plugin": "^2.11.0",
|
|
92
|
+
"@typescript-eslint/parser": "^2.11.0",
|
|
93
|
+
"chai": "^4.2.0",
|
|
94
|
+
"eslint": "^6.7.2",
|
|
95
|
+
"eslint-plugin-prettier": "^3.1.1",
|
|
96
|
+
"linklocal": "^2.8.2",
|
|
97
|
+
"lint-staged": "^10.5.3",
|
|
98
|
+
"mocha": "^6.2.2",
|
|
99
|
+
"prettier": "1.19.1",
|
|
100
|
+
"rimraf": "^3.0.0",
|
|
101
|
+
"rollup": "^1.27.12",
|
|
102
|
+
"rollup-plugin-commonjs": "^10.1.0",
|
|
103
|
+
"rollup-plugin-node-resolve": "^5.2.0",
|
|
104
|
+
"rollup-plugin-typescript": "^1.0.1",
|
|
105
|
+
"typescript": "^3.7.3"
|
|
106
|
+
},
|
|
107
|
+
"dependencies": {
|
|
108
|
+
"@sinonjs/text-encoding": "^0.7.2",
|
|
109
|
+
"js-base64": "^3.7.2"
|
|
110
|
+
},
|
|
111
|
+
"gitHooks": {
|
|
112
|
+
"pre-commit": "lint-staged"
|
|
113
|
+
},
|
|
114
|
+
"lint-staged": {
|
|
115
|
+
"src/**/*.ts": [
|
|
116
|
+
"npm run lint",
|
|
117
|
+
"prettier --parser typescript --write",
|
|
118
|
+
"git add"
|
|
119
|
+
]
|
|
120
|
+
}
|
|
107
121
|
}
|
package/src/index.ts
CHANGED
|
@@ -814,7 +814,15 @@ function read(
|
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
816
|
if (result_name) {
|
|
817
|
-
attachment.name =
|
|
817
|
+
attachment.name = result_name;
|
|
818
|
+
|
|
819
|
+
if (/%[0-9A-Fa-f]{2}/.test(result_name)) {
|
|
820
|
+
try {
|
|
821
|
+
attachment.name = decodeURIComponent(result_name);
|
|
822
|
+
} catch {
|
|
823
|
+
attachment.name = result_name;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
818
826
|
}
|
|
819
827
|
|
|
820
828
|
const ct = headers['Content-Type'] || headers['Content-type'];
|
package/src/interface.ts
CHANGED