lite-email-parser 2.0.3 → 2.1.7
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/dist/index.cjs +29 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -29
- package/package.json +14 -29
- package/binding.gyp +0 -47
- package/core/include/html_extractor.h +0 -100
- package/core/include/html_parser.h +0 -13
- package/core/src/html_extractor.cpp +0 -662
- package/core/src/html_parser.cpp +0 -221
- package/deps/gumbo-parser/src/attribute.c +0 -44
- package/deps/gumbo-parser/src/attribute.h +0 -37
- package/deps/gumbo-parser/src/char_ref.c +0 -301
- package/deps/gumbo-parser/src/char_ref.h +0 -70
- package/deps/gumbo-parser/src/char_ref_gperf.c +0 -11126
- package/deps/gumbo-parser/src/error.c +0 -287
- package/deps/gumbo-parser/src/error.h +0 -225
- package/deps/gumbo-parser/src/gumbo.h +0 -683
- package/deps/gumbo-parser/src/insertion_mode.h +0 -55
- package/deps/gumbo-parser/src/parser.c +0 -4433
- package/deps/gumbo-parser/src/parser.h +0 -57
- package/deps/gumbo-parser/src/string_buffer.c +0 -110
- package/deps/gumbo-parser/src/string_buffer.h +0 -84
- package/deps/gumbo-parser/src/string_piece.c +0 -48
- package/deps/gumbo-parser/src/string_piece.h +0 -38
- package/deps/gumbo-parser/src/tag.c +0 -125
- package/deps/gumbo-parser/src/tag_enum.h +0 -155
- package/deps/gumbo-parser/src/tag_gperf.h +0 -350
- package/deps/gumbo-parser/src/tag_sizes.h +0 -2
- package/deps/gumbo-parser/src/tag_strings.h +0 -155
- package/deps/gumbo-parser/src/token_type.h +0 -42
- package/deps/gumbo-parser/src/tokenizer.c +0 -3003
- package/deps/gumbo-parser/src/tokenizer.h +0 -123
- package/deps/gumbo-parser/src/tokenizer_states.h +0 -104
- package/deps/gumbo-parser/src/utf8.c +0 -270
- package/deps/gumbo-parser/src/utf8.h +0 -132
- package/deps/gumbo-parser/src/util.c +0 -58
- package/deps/gumbo-parser/src/util.h +0 -60
- package/deps/gumbo-parser/src/vector.c +0 -128
- package/deps/gumbo-parser/src/vector.h +0 -70
- package/dist/cjs/index.cjs +0 -63
- package/dist/cjs/index.d.cts +0 -9
- package/dist/cjs/index.d.cts.map +0 -1
- package/dist/cjs/index.d.ts +0 -9
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js +0 -92
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/parser.d.ts +0 -4
- package/dist/cjs/parser.d.ts.map +0 -1
- package/dist/cjs/parser.js +0 -118
- package/dist/cjs/types.d.ts +0 -14
- package/dist/cjs/types.d.ts.map +0 -1
- package/dist/cjs/types.js +0 -2
- package/dist/parser.d.ts +0 -4
- package/dist/parser.d.ts.map +0 -1
- package/dist/parser.js +0 -81
- package/src/addon.cpp +0 -141
package/dist/index.cjs
CHANGED
|
@@ -39,10 +39,35 @@ exports.removeSignature = removeSignature;
|
|
|
39
39
|
exports.removeReplies = removeReplies;
|
|
40
40
|
exports.removeDividers = removeDividers;
|
|
41
41
|
exports.replaceSrc = replaceSrc;
|
|
42
|
-
const
|
|
43
|
-
//
|
|
44
|
-
const
|
|
45
|
-
|
|
42
|
+
const os = __importStar(require("os"));
|
|
43
|
+
// Map of platform-arch to the corresponding scoped package name
|
|
44
|
+
const PLATFORM_PACKAGES = {
|
|
45
|
+
'linux-x64': '@lite-email-parser-native/linux-x64',
|
|
46
|
+
'linux-arm64': '@lite-email-parser-native/linux-arm64',
|
|
47
|
+
'darwin-x64': '@lite-email-parser-native/darwin-x64',
|
|
48
|
+
'darwin-arm64': '@lite-email-parser-native/darwin-arm64',
|
|
49
|
+
'win32-x64': '@lite-email-parser-native/win32-x64',
|
|
50
|
+
};
|
|
51
|
+
function loadAddon() {
|
|
52
|
+
const platform = os.platform();
|
|
53
|
+
const arch = os.arch();
|
|
54
|
+
const key = `${platform}-${arch}`;
|
|
55
|
+
const packageName = PLATFORM_PACKAGES[key];
|
|
56
|
+
if (!packageName) {
|
|
57
|
+
throw new Error(`lite-email-parser: unsupported platform ${platform}-${arch}. ` +
|
|
58
|
+
`Supported: ${Object.keys(PLATFORM_PACKAGES).join(', ')}`);
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return require(packageName);
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
throw new Error(`lite-email-parser: failed to load native binary for ${platform}-${arch}. ` +
|
|
65
|
+
`Make sure "${packageName}" is installed. ` +
|
|
66
|
+
`If you're using npm, ensure optionalDependencies are not disabled.\n` +
|
|
67
|
+
`Original error: ${e.message}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const addon = loadAddon();
|
|
46
71
|
async function parseEmail(buffer) {
|
|
47
72
|
return addon.parseEmail(buffer);
|
|
48
73
|
}
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAsCrD,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAE1E;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,CAE/D;AAGD,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAwCrD,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAE1E;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,CAE/D;AAGD,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
|
-
import * as
|
|
3
|
-
const _require =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import * as os from 'os';
|
|
3
|
+
const _require = createRequire(import.meta.url);
|
|
4
|
+
// Map of platform-arch to the corresponding scoped package name
|
|
5
|
+
const PLATFORM_PACKAGES = {
|
|
6
|
+
'linux-x64': '@lite-email-parser-native/linux-x64',
|
|
7
|
+
'linux-arm64': '@lite-email-parser-native/linux-arm64',
|
|
8
|
+
'darwin-x64': '@lite-email-parser-native/darwin-x64',
|
|
9
|
+
'darwin-arm64': '@lite-email-parser-native/darwin-arm64',
|
|
10
|
+
'win32-x64': '@lite-email-parser-native/win32-x64',
|
|
11
|
+
};
|
|
12
|
+
function loadAddon() {
|
|
13
|
+
const platform = os.platform();
|
|
14
|
+
const arch = os.arch();
|
|
15
|
+
const key = `${platform}-${arch}`;
|
|
16
|
+
const packageName = PLATFORM_PACKAGES[key];
|
|
17
|
+
if (!packageName) {
|
|
18
|
+
throw new Error(`lite-email-parser: unsupported platform ${platform}-${arch}. ` +
|
|
19
|
+
`Supported: ${Object.keys(PLATFORM_PACKAGES).join(', ')}`);
|
|
9
20
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (cleanPath.startsWith('file://')) {
|
|
19
|
-
const fileURLToPath = _require('url').fileURLToPath;
|
|
20
|
-
cleanPath = fileURLToPath(cleanPath);
|
|
21
|
-
}
|
|
22
|
-
return path.dirname(cleanPath);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
21
|
+
try {
|
|
22
|
+
return _require(packageName);
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
throw new Error(`lite-email-parser: failed to load native binary for ${platform}-${arch}. ` +
|
|
26
|
+
`Make sure "${packageName}" is installed. ` +
|
|
27
|
+
`If you're using npm, ensure optionalDependencies are not disabled.\n` +
|
|
28
|
+
`Original error: ${e.message}`);
|
|
25
29
|
}
|
|
26
|
-
return process.cwd();
|
|
27
|
-
};
|
|
28
|
-
const dirname = getDirname();
|
|
29
|
-
let addonPath = path.resolve(dirname, '../build/Release/parser.node');
|
|
30
|
-
if (!_require('fs').existsSync(addonPath)) {
|
|
31
|
-
addonPath = path.resolve(dirname, '../../build/Release/parser.node');
|
|
32
30
|
}
|
|
33
|
-
const addon =
|
|
31
|
+
const addon = loadAddon();
|
|
34
32
|
export async function parseEmail(buffer) {
|
|
35
33
|
return addon.parseEmail(buffer);
|
|
36
34
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lite-email-parser",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.7",
|
|
4
4
|
"description": "Parse email to get signature, replies, attachments and inline images",
|
|
5
|
-
"main": "./dist/
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -12,38 +12,18 @@
|
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"require": {
|
|
15
|
-
"types": "./dist/
|
|
16
|
-
"default": "./dist/
|
|
15
|
+
"types": "./dist/index.d.cts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
|
-
"dist/"
|
|
22
|
-
"binding.gyp",
|
|
23
|
-
"src/addon.cpp",
|
|
24
|
-
"core/include/",
|
|
25
|
-
"core/src/*.cpp",
|
|
26
|
-
"deps/gumbo-parser/src/*.c",
|
|
27
|
-
"deps/gumbo-parser/src/*.h"
|
|
21
|
+
"dist/"
|
|
28
22
|
],
|
|
29
|
-
"binary": {
|
|
30
|
-
"module_name": "parser",
|
|
31
|
-
"module_path": "./build/Release/",
|
|
32
|
-
"host": "https://github.com/philipedc/lite-email-parser/releases/download/",
|
|
33
|
-
"remote_path": "{version}",
|
|
34
|
-
"package_name": "{module_name}-v{version}-napi-v9-{platform}-{arch}.tar.gz",
|
|
35
|
-
"napi_versions": [
|
|
36
|
-
9
|
|
37
|
-
]
|
|
38
|
-
},
|
|
39
23
|
"scripts": {
|
|
40
|
-
"install": "prebuild-install || node-gyp rebuild",
|
|
41
24
|
"build:native": "node-gyp rebuild",
|
|
42
|
-
"build:ts": "npx tsc
|
|
25
|
+
"build:ts": "npx tsc",
|
|
43
26
|
"build": "npm run build:native && npm run build:ts",
|
|
44
|
-
"prebuild": "node-gyp rebuild && tar -czf parser-v2.0.0-napi-v9-linux-x64.tar.gz -C build/Release parser.node",
|
|
45
|
-
"prepublishOnly": "cp -r ../core ./core && mkdir -p ./deps && cp -r ../deps/gumbo-parser ./deps/gumbo-parser",
|
|
46
|
-
"postpublish": "rm -rf ./core ./deps",
|
|
47
27
|
"test": "npx -y tsx samples/sample.ts"
|
|
48
28
|
},
|
|
49
29
|
"contributors": [
|
|
@@ -81,12 +61,17 @@
|
|
|
81
61
|
"email-to-html",
|
|
82
62
|
"signature-remover"
|
|
83
63
|
],
|
|
84
|
-
"dependencies": {
|
|
85
|
-
|
|
86
|
-
"
|
|
64
|
+
"dependencies": {},
|
|
65
|
+
"optionalDependencies": {
|
|
66
|
+
"@lite-email-parser-native/linux-x64": "2.1.7",
|
|
67
|
+
"@lite-email-parser-native/linux-arm64": "2.1.7",
|
|
68
|
+
"@lite-email-parser-native/darwin-x64": "2.1.7",
|
|
69
|
+
"@lite-email-parser-native/darwin-arm64": "2.1.7",
|
|
70
|
+
"@lite-email-parser-native/win32-x64": "2.1.7"
|
|
87
71
|
},
|
|
88
72
|
"devDependencies": {
|
|
89
73
|
"@types/node": "^20.11.0",
|
|
74
|
+
"node-addon-api": "^8.0.0",
|
|
90
75
|
"node-gyp": "^13.0.0",
|
|
91
76
|
"typescript": "^7.0.2"
|
|
92
77
|
}
|
package/binding.gyp
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"variables": {
|
|
3
|
-
"src_root%": "<!(node -e \"var fs=require('fs');console.log(fs.existsSync('core')?'./':'../')\")"
|
|
4
|
-
},
|
|
5
|
-
"targets": [
|
|
6
|
-
{
|
|
7
|
-
"target_name": "parser",
|
|
8
|
-
"sources": [
|
|
9
|
-
"src/addon.cpp",
|
|
10
|
-
"<(src_root)core/src/html_parser.cpp",
|
|
11
|
-
"<(src_root)core/src/html_extractor.cpp",
|
|
12
|
-
"<(src_root)deps/gumbo-parser/src/attribute.c",
|
|
13
|
-
"<(src_root)deps/gumbo-parser/src/char_ref.c",
|
|
14
|
-
"<(src_root)deps/gumbo-parser/src/char_ref_gperf.c",
|
|
15
|
-
"<(src_root)deps/gumbo-parser/src/error.c",
|
|
16
|
-
"<(src_root)deps/gumbo-parser/src/parser.c",
|
|
17
|
-
"<(src_root)deps/gumbo-parser/src/string_buffer.c",
|
|
18
|
-
"<(src_root)deps/gumbo-parser/src/string_piece.c",
|
|
19
|
-
"<(src_root)deps/gumbo-parser/src/tag.c",
|
|
20
|
-
"<(src_root)deps/gumbo-parser/src/tokenizer.c",
|
|
21
|
-
"<(src_root)deps/gumbo-parser/src/utf8.c",
|
|
22
|
-
"<(src_root)deps/gumbo-parser/src/util.c",
|
|
23
|
-
"<(src_root)deps/gumbo-parser/src/vector.c"
|
|
24
|
-
],
|
|
25
|
-
"include_dirs": [
|
|
26
|
-
"<!@(node -p \"require('node-addon-api').include\")",
|
|
27
|
-
"<(src_root)core/include",
|
|
28
|
-
"<(src_root)deps/gumbo-parser/src"
|
|
29
|
-
],
|
|
30
|
-
"dependencies": [
|
|
31
|
-
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api"
|
|
32
|
-
],
|
|
33
|
-
"libraries": [],
|
|
34
|
-
"defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ],
|
|
35
|
-
"cflags!": [ "-fno-exceptions" ],
|
|
36
|
-
"cflags_cc!": [ "-fno-exceptions" ],
|
|
37
|
-
"xcode_settings": {
|
|
38
|
-
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
|
|
39
|
-
"CLANG_CXX_LIBRARY": "libc++",
|
|
40
|
-
"MACOSX_DEPLOYMENT_TARGET": "10.7"
|
|
41
|
-
},
|
|
42
|
-
"msvs_settings": {
|
|
43
|
-
"VCCLCompilerTool": { "ExceptionHandling": 1 }
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
#ifndef HTML_EXTRACTOR_H
|
|
2
|
-
#define HTML_EXTRACTOR_H
|
|
3
|
-
|
|
4
|
-
#include <string>
|
|
5
|
-
#include <vector>
|
|
6
|
-
|
|
7
|
-
namespace liteEmailParser {
|
|
8
|
-
|
|
9
|
-
// Represents a file attachment (mirrors IFile from types.ts)
|
|
10
|
-
struct Attachment {
|
|
11
|
-
std::string name; // filename (defaults to current date if absent)
|
|
12
|
-
std::string type; // MIME content type (e.g. "image/png")
|
|
13
|
-
std::size_t size = 0; // size in bytes
|
|
14
|
-
std::string buffer; // raw binary content
|
|
15
|
-
std::string src; // uploaded URL (populated by replaceSrc after upload)
|
|
16
|
-
std::string originalSrc; // base64 data URI for inline attachments (e.g. "data:image/png;base64,...")
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// Full result of parsing an email
|
|
20
|
-
struct ParseEmailResult {
|
|
21
|
-
std::string subject;
|
|
22
|
-
std::string from;
|
|
23
|
-
std::string to;
|
|
24
|
-
std::string text; // cleaned HTML (or plain text fallback)
|
|
25
|
-
std::vector<Attachment> attachments; // regular attachments
|
|
26
|
-
std::vector<Attachment> inlineAttachments; // inline (cid-referenced) attachments
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// Result of HTML extraction from a raw email buffer
|
|
30
|
-
struct ExtractionResult {
|
|
31
|
-
std::string body; // HTML content (or plain text fallback)
|
|
32
|
-
bool isHtml; // true if body came from a text/html part
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// Main entry point: parses a raw .eml buffer into a full result.
|
|
36
|
-
ParseEmailResult parseEmail(const std::string& rawEmail);
|
|
37
|
-
|
|
38
|
-
// Main entry point: extracts the HTML (or text) body from a raw .eml buffer.
|
|
39
|
-
// Parses MIME boundaries, finds the text/html part (falls back to text/plain),
|
|
40
|
-
// and decodes Content-Transfer-Encoding (quoted-printable or base64).
|
|
41
|
-
ExtractionResult extractHtmlBody(const std::string& rawEmail);
|
|
42
|
-
|
|
43
|
-
// Reads an .eml file from disk into a string buffer
|
|
44
|
-
std::string readEmailFile(const std::string& filePath);
|
|
45
|
-
|
|
46
|
-
// Replaces img src attributes in HTML: for each file with originalSrc and src set,
|
|
47
|
-
// finds matching img elements and swaps the src to the new URL.
|
|
48
|
-
std::string replaceSrc(const std::string& html, const std::vector<Attachment>& files);
|
|
49
|
-
|
|
50
|
-
namespace detail {
|
|
51
|
-
|
|
52
|
-
// Represents a single MIME part extracted from the email
|
|
53
|
-
struct MimePart {
|
|
54
|
-
std::string contentType; // e.g. "text/html; charset=\"UTF-8\""
|
|
55
|
-
std::string transferEncoding; // e.g. "quoted-printable", "base64"
|
|
56
|
-
std::string contentId; // e.g. "ii_mrnoxu771" (without angle brackets)
|
|
57
|
-
std::string contentDisposition; // e.g. "attachment", "inline"
|
|
58
|
-
std::string filename; // from Content-Disposition or Content-Type name=
|
|
59
|
-
std::string body; // raw body content of this part
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// Parse the top-level Content-Type header to extract the boundary string
|
|
63
|
-
std::string extractBoundary(const std::string& contentTypeHeader);
|
|
64
|
-
|
|
65
|
-
// Split a raw email (or a multipart section) into its MIME parts by boundary.
|
|
66
|
-
// Recurses into nested multipart parts.
|
|
67
|
-
std::vector<MimePart> parseMimeParts(const std::string& rawContent,
|
|
68
|
-
const std::string& boundary);
|
|
69
|
-
|
|
70
|
-
// Extract a header value from raw headers block (case-insensitive key match)
|
|
71
|
-
std::string getHeaderValue(const std::string& headers, const std::string& key);
|
|
72
|
-
|
|
73
|
-
// Decode quoted-printable encoded content
|
|
74
|
-
std::string decodeQuotedPrintable(const std::string& input);
|
|
75
|
-
|
|
76
|
-
// Decode base64 encoded content
|
|
77
|
-
std::string decodeBase64(const std::string& input);
|
|
78
|
-
|
|
79
|
-
// Encode binary data to base64
|
|
80
|
-
std::string encodeBase64(const std::string& input);
|
|
81
|
-
|
|
82
|
-
// Extract the MIME type (e.g. "image/png") from a Content-Type header value
|
|
83
|
-
std::string extractMimeType(const std::string& contentTypeHeader);
|
|
84
|
-
|
|
85
|
-
// Extract Content-ID value, stripping angle brackets
|
|
86
|
-
std::string extractContentId(const std::string& contentIdHeader);
|
|
87
|
-
|
|
88
|
-
// Extract filename from Content-Disposition or Content-Type name= parameter
|
|
89
|
-
std::string extractFilename(const std::string& contentDisposition,
|
|
90
|
-
const std::string& contentType);
|
|
91
|
-
|
|
92
|
-
// Replace cid: references in HTML with base64 data URIs using the provided parts
|
|
93
|
-
std::string replaceCidWithBase64(const std::string& html,
|
|
94
|
-
const std::vector<MimePart>& parts);
|
|
95
|
-
|
|
96
|
-
} // namespace detail
|
|
97
|
-
|
|
98
|
-
} // namespace liteEmailParser
|
|
99
|
-
|
|
100
|
-
#endif // HTML_EXTRACTOR_H
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#ifndef HTML_PARSER_H
|
|
2
|
-
#define HTML_PARSER_H
|
|
3
|
-
|
|
4
|
-
#include <string>
|
|
5
|
-
|
|
6
|
-
namespace liteEmailParser {
|
|
7
|
-
std::string removeSignature(std::string html);
|
|
8
|
-
std::string removeReplies(std::string html);
|
|
9
|
-
std::string removeDividers(std::string html);
|
|
10
|
-
std::string cleanHtml(std::string html);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
#endif // HTML_PARSER_H
|