File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " email-viewer" ,
3
- "version" : " 1.0.1 " ,
3
+ "version" : " 1.1.0 " ,
4
4
"license" : " MIT" ,
5
5
"author" : " OreQr" ,
6
6
"description" : " 📧Opens browser with email preview" ,
Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ import { randomUUID } from "crypto"
2
2
import ejs from "ejs"
3
3
import template from "templates/template.ejs"
4
4
import os from "os"
5
- import openFile from "open"
6
5
import path from "path"
7
6
import fs from "fs"
7
+ import openFile from "open"
8
+ import { openExplorer } from "./open"
8
9
9
10
export interface ViewEmailOptions {
10
11
id ?: string
@@ -28,7 +29,13 @@ export const viewEmail = (options: ViewEmailOptions): ViewEmailResult => {
28
29
if ( open ) {
29
30
const filePath = path . join ( dir , `${ id } .html` )
30
31
fs . writeFileSync ( filePath , html )
31
- openFile ( `file://${ filePath } ` )
32
+
33
+ const target = `file://${ filePath } `
34
+ if ( process . platform === "win32" ) {
35
+ openExplorer ( target )
36
+ } else {
37
+ openFile ( target )
38
+ }
32
39
}
33
40
34
41
return { id, html }
Original file line number Diff line number Diff line change
1
+ import { exec } from "child_process"
2
+
3
+ export const openExplorer = ( target : string ) => {
4
+ exec ( "explorer " + target )
5
+ }
You can’t perform that action at this time.
0 commit comments