Skip to content

Commit

Permalink
Add support for Personal Storage Table (PST) file, .pst (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Jan 11, 2023
1 parent 976ed4b commit ec3ba33
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 3 deletions.
6 changes: 4 additions & 2 deletions core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ export type FileExtension =
| 'zst'
| 'jxl'
| 'vcf'
| 'jls';
| 'jls'
| 'pst';

export type MimeType =
| 'image/jpeg'
Expand Down Expand Up @@ -278,7 +279,8 @@ export type MimeType =
| 'model/3mf'
| 'image/jxl'
| 'application/zstd'
| 'image/jls';
| 'image/jls'
| 'application/vnd.ms-outlook';

export type FileTypeResult = {
/**
Expand Down
7 changes: 7 additions & 0 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,13 @@ class FileTypeParser {
};
}

if (this.check([0x21, 0x42, 0x44, 0x4E])) {
return {
ext: 'pst',
mime: 'application/vnd.ms-outlook',
};
}

// -- 5-byte signatures --

if (this.check([0x4F, 0x54, 0x54, 0x4F, 0x00])) {
Expand Down
Binary file added fixture/fixture-sample.pst
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@
"zst",
"jxl",
"vcf",
"jls"
"jls",
"pst"
],
"dependencies": {
"readable-web-to-node-stream": "^3.0.2",
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ Returns a `Set<string>` of supported MIME types.
- [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Powerpoint
- [`ps`](https://en.wikipedia.org/wiki/Postscript) - Postscript
- [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) - Adobe Photoshop document
- [`pst`](https://en.wikipedia.org/wiki/Personal_Storage_Table) - Personal Storage Table file
- [`qcp`](https://en.wikipedia.org/wiki/QCP) - Tagged and chunked data
- [`raf`](https://en.wikipedia.org/wiki/Raw_image_format) - Fujifilm RAW image file
- [`rar`](https://en.wikipedia.org/wiki/RAR_(file_format)) - Archive file
Expand Down
2 changes: 2 additions & 0 deletions supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const extensions = [
'jxl',
'vcf',
'jls',
'pst',
];

export const mimeTypes = [
Expand Down Expand Up @@ -277,4 +278,5 @@ export const mimeTypes = [
'image/jxl',
'application/zstd',
'image/jls',
'application/vnd.ms-outlook',
];
3 changes: 3 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ const names = {
'fixture-hp2',
'fixture-hp3',
],
pst: [
'fixture-sample',
],
};

// Define an entry here only if the file type has potential
Expand Down

0 comments on commit ec3ba33

Please sign in to comment.