@kenjiuno/msgreader
Advanced tools
Comparing version 1.2.5 to 1.2.6
@@ -49,11 +49,11 @@ declare const _default: { | ||
'0c1f': string; | ||
'1000': string; | ||
1000: string; | ||
'007d': string; | ||
'1009': string; | ||
'3703': string; | ||
'3704': string; | ||
'3707': string; | ||
'3712': string; | ||
'3001': string; | ||
'3003': string; | ||
1009: string; | ||
3703: string; | ||
3704: string; | ||
3707: string; | ||
3712: string; | ||
3001: string; | ||
3003: string; | ||
}; | ||
@@ -60,0 +60,0 @@ CLASS_MAPPING: { |
@@ -41,3 +41,4 @@ /** | ||
_dynamicSize: boolean; | ||
dynamicSize: boolean; | ||
get dynamicSize(): boolean; | ||
set dynamicSize(v: boolean); | ||
/** | ||
@@ -54,3 +55,3 @@ Virtual byte length of the DataStream backing buffer. | ||
*/ | ||
readonly byteLength: number; | ||
get byteLength(): number; | ||
/** | ||
@@ -61,3 +62,4 @@ Set/get the backing ArrayBuffer of the DataStream object. | ||
*/ | ||
buffer: ArrayBuffer; | ||
get buffer(): ArrayBuffer; | ||
set buffer(v: ArrayBuffer); | ||
/** | ||
@@ -68,3 +70,4 @@ Set/get the byteOffset of the DataStream object. | ||
*/ | ||
byteOffset: number; | ||
get byteOffset(): number; | ||
set byteOffset(v: number); | ||
/** | ||
@@ -75,3 +78,4 @@ Set/get the backing DataView of the DataStream object. | ||
*/ | ||
dataView: DataView; | ||
get dataView(): DataView; | ||
set dataView(v: DataView); | ||
/** | ||
@@ -78,0 +82,0 @@ Internal function to resize the DataStream buffer when required. |
@@ -8,3 +8,3 @@ "use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -30,5 +30,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var DataStream = | ||
/*#__PURE__*/ | ||
function () { | ||
var DataStream = /*#__PURE__*/function () { | ||
function DataStream(arrayBuffer, byteOffset, endianness) { | ||
@@ -35,0 +33,0 @@ _classCallCheck(this, DataStream); |
@@ -359,4 +359,3 @@ "use strict"; | ||
ds.seek(blockStartOffset + bigBlockOffset); | ||
var toReadLength = Math.min(Math.min(msgData.bigBlockSize - bigBlockOffset, blockSize), _const["default"].MSG.SMALL_BLOCK_SIZE); | ||
return ds.readUint8Array(toReadLength); | ||
return ds.readUint8Array(blockSize); | ||
} | ||
@@ -451,5 +450,3 @@ } | ||
var MsgReader = | ||
/*#__PURE__*/ | ||
function () { | ||
var MsgReader = /*#__PURE__*/function () { | ||
function MsgReader(arrayBuffer) { | ||
@@ -456,0 +453,0 @@ _classCallCheck(this, MsgReader); |
{ | ||
"name": "@kenjiuno/msgreader", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"description": "", | ||
@@ -32,4 +32,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@kenjiuno/decompressrtf": "^0.1.2", | ||
"@kenjiuno/iconvlite-wrapper-with-iso2022jp": "^0.1.0" | ||
} | ||
} |
@@ -10,3 +10,4 @@ # msgreader | ||
This repo contains the core of the modified project as npm package. | ||
This repo contains the code of the modified project. | ||
And also it is published as a [npm package](https://www.npmjs.com/package/@kenjiuno/msgreader). | ||
@@ -53,1 +54,86 @@ ## How to use | ||
``` | ||
### List attachment files | ||
```javascript | ||
const msgFileBuffer = fs.readFileSync(msgFilePath) | ||
const testMsg = new MsgReader(msgFileBuffer) | ||
const testMsgInfo = testMsg.getFileData() | ||
for (const att of testMsgInfo.attachments) { | ||
console.log(att.fileName); | ||
// testMsg.getAttachment(att).content | ||
} | ||
``` | ||
## Build msgreader locally | ||
```bat | ||
yarn | ||
``` | ||
## Optional command line tool | ||
This can be used for testing this tool. | ||
```bat | ||
C:\Proj\msgreader>node cli -h | ||
Usage: cli [options] [command] | ||
Options: | ||
-h, --help output usage information | ||
Commands: | ||
parse [options] <msgFilePath> Parse msg file and print parsed structure | ||
rtf <msgFilePath> [saveToRtfFilePath] Parse msg file and print decompressed rtf | ||
list-att <msgFilePath> Parse msg file and list attachment file names | ||
save-att <msgFilePath> <saveToDir> Parse msg file and write all attachment files | ||
``` | ||
Obtain decompressed RTF file from `test/test1.msg`: | ||
```bat | ||
C:\Proj\msgreader>node cli rtf test\test1.msg test1.rtf | ||
C:\Proj\msgreader>type test1.rtf | ||
{\rtf1\ansi\ansicpg1252\fromtext \fbidis \deff0{\fonttbl | ||
{\f0\fswiss Arial;} | ||
{\f1\fmodern Courier New;} | ||
{\f2\fnil\fcharset2 Symbol;} | ||
{\f3\fmodern\fcharset0 Courier New;}} | ||
{\colortbl\red0\green0\blue0;\red0\green0\blue255;} | ||
\uc1\pard\plain\deftab360 \f0\fs20 body\par | ||
} | ||
``` | ||
List attachment files in `test/test2.msg`: | ||
```bat | ||
C:\Proj\msgreader>node cli list-att test\test2.msg | ||
A.txt | ||
``` | ||
Extract attacument files into folder `test2`: | ||
```bat | ||
C:\Proj\msgreader>node cli save-att test\test2.msg test2 | ||
``` | ||
```bat | ||
C:\Proj\msgreader>dir test2 | ||
Volume in drive C has no label. | ||
Volume Serial Number is CA6D-4F59 | ||
Directory of C:\Proj\msgreader\test2 | ||
2020/03/19 19:40 <DIR> . | ||
2020/03/19 19:40 <DIR> .. | ||
2020/03/19 19:40 11 A.txt | ||
1 File(s) 11 bytes | ||
2 Dir(s) 9,542,762,496 bytes free | ||
``` | ||
```bat | ||
C:\Proj\msgreader>type test2\A.txt | ||
attach test | ||
``` |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
117451
14
2901
138
2
2
+ Added@kenjiuno/decompressrtf@0.1.4(transitive)