Skip to content

Commit 9cba195

Browse files
committed
Change getFileDataURI to getFileObject
1 parent 6268b58 commit 9cba195

3 files changed

Lines changed: 32 additions & 7 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
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.19.0"
22+
"markedit-api": "https://github.com/MarkEdit-app/MarkEdit-api#v0.20.0"
2323
}
2424
}
2525
```
@@ -60,8 +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>;
63+
// Get the binary data and type information of a file.
64+
getFileObject(path?: string): Promise<FileObject | undefined>;
6565
// Get the information of a file.
6666
getFileInfo(path?: string): Promise<FileInfo | undefined>;
6767
// Get the path of a standard directory.

index.d.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ export interface MarkEdit {
160160
getFileContent(path?: string): Promise<string | undefined>;
161161

162162
/**
163-
* Get the data URI (base64 encoded) of a file.
163+
* Get the binary data and type information of a file.
164164
* @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.
165+
* @returns The file object, or undefined if failed.
166166
*/
167-
getFileDataURI(path?: string): Promise<string | undefined>;
167+
getFileObject(path?: string): Promise<FileObject | undefined>;
168168

169169
/**
170170
* Get the information of a file.
@@ -415,6 +415,31 @@ export type TranslationResponse =
415415
| { succeeded: true; text: string }
416416
| { succeeded: false; error: string };
417417

418+
/**
419+
* Represents a file object with data and type information.
420+
*/
421+
export type FileObject = {
422+
/**
423+
* Base64 representation of the file.
424+
*/
425+
data: string;
426+
427+
/**
428+
* Uniform Type Identifier (UTI) of the file.
429+
*/
430+
typeIdentifier?: string;
431+
432+
/**
433+
* MIME type of the file.
434+
*/
435+
mimeType?: string;
436+
437+
/**
438+
* File extension of the file.
439+
*/
440+
filenameExtension?: string;
441+
}
442+
418443
/**
419444
* Information of a file in the file system.
420445
*/

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.19.0",
3+
"version": "0.20.0",
44
"description": "Type definitions for the latest MakrEdit API.",
55
"main": "./index.cjs",
66
"module": "./index.js",

0 commit comments

Comments
 (0)