Skip to content

Commit 6268b58

Browse files
committed
Add MarkEdit.getFileDataURI for binary files
1 parent 4fe9abf commit 6268b58

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Add `markedit-api` to your (TypeScript) project's devDependencies:
1919
```json
2020
{
2121
"devDependencies": {
22-
"markedit-api": "https://github.com/MarkEdit-app/MarkEdit-api#v0.18.0"
22+
"markedit-api": "https://github.com/MarkEdit-app/MarkEdit-api#v0.19.0"
2323
}
2424
}
2525
```
@@ -60,6 +60,8 @@ interface MarkEdit {
6060
listFiles(path: string): Promise<string[] | undefined>;
6161
// Get the content of a file.
6262
getFileContent(path?: string): Promise<string | undefined>;
63+
// Get the data URI (base64 encoded) of a file.
64+
getFileDataURI(path?: string): Promise<string | undefined>;
6365
// Get the information of a file.
6466
getFileInfo(path?: string): Promise<FileInfo | undefined>;
6567
// Get the path of a standard directory.

index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ export interface MarkEdit {
159159
*/
160160
getFileContent(path?: string): Promise<string | undefined>;
161161

162+
/**
163+
* Get the data URI (base64 encoded) of a file.
164+
* @param path The file path. The current file is used as a fallback.
165+
* @returns The file data URI as a string, or undefined if failed.
166+
*/
167+
getFileDataURI(path?: string): Promise<string | undefined>;
168+
162169
/**
163170
* Get the information of a file.
164171
* @param path The file path. The current file is used as a fallback.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "markedit-api",
3-
"version": "0.18.0",
3+
"version": "0.19.0",
44
"description": "Type definitions for the latest MakrEdit API.",
55
"main": "./index.cjs",
66
"module": "./index.js",

0 commit comments

Comments
 (0)