Skip to content

Commit

Permalink
Add ts-bindings for file detection
Browse files Browse the repository at this point in the history
Added code in TS to use the file detection functionality from
rust core.
  • Loading branch information
sudeeptarlekar committed Jan 10, 2024
1 parent 59df6db commit dd5f712
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions application/apps/rustcore/ts-bindings/src/api/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,27 @@ export class Jobs extends Base {
return job;
}

public isFileBinary(options: {
filePath: string,
}): CancelablePromise<boolean> {
const sequence = this.sequence();
const job: CancelablePromise<boolean> = this.execute(
(res: string): any | Error => {
if (typeof res !== 'string') {
return new Error(`[jobs.isFileBinary] Expecting string, but got: ${typeof res}`);
}
return res;
},
this.native.isFileBinary(
sequence,
options.filePath
),
sequence,
'isFileBinary'
);
return job;
}

public spawnProcess(path: string, args: string[]): CancelablePromise<void> {
const sequence = this.sequence();
const job: CancelablePromise<void> = this.execute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export abstract class JobsNative {

public abstract destroy(): Promise<void>;

public abstract isFileBinary(sequence: number, filePath: string): Promise<void>;

public abstract jobCancelTest(sequence: number, num_a: number, num_b: number): Promise<string>;

public abstract listFolderContent(
Expand Down

0 comments on commit dd5f712

Please sign in to comment.