fix(tauri.js): fix return type for readBinaryFile api method (#927)

* fix(tauri.js): fix return type for `readBinaryFile` api method

* chore(tauri.js): add changelog
This commit is contained in:
Oleg Shilov 2020-08-08 03:56:29 +03:00 committed by GitHub
parent 0a5bac1dd6
commit f98d4b9076
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 18 deletions

View File

@ -0,0 +1,6 @@
---
"tauri.js": patch
---
- Set correct promise resolve type which returns from `readBinaryFile`
- Add types to JSDoc annotations

View File

@ -1,11 +1,13 @@
# Changes
##### via https://github.com/jbolda/covector
As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version *number*, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend it represents the overall change for our sanity.
As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version _number_, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend it represents the overall change for our sanity.
When you select the version bump required, you do *not* need to consider depedencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process.
When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process.
Use the following format:
```md
---
"tauri.js": patch
@ -13,7 +15,6 @@ Use the following format:
---
Change summary goes here
```
Summaries do not have a specific character limit, but are text only. These summaries are used within the (future implementation of) changelogs. They will give context to the change and also point back to the original PR if more details and context are needed.

View File

@ -45,15 +45,18 @@ export interface FileEntry {
}
/**
* reads a file as text
*
* @param filePath path to the file
* @param [options] configuration object
* @param [options.dir] base directory
* @return
* @name readTextFile
* @description Reads a file as text
* @param {string} filePath path to the file
* @param {FsOptions} [options] configuration object
* @param {BaseDirectory} [options.dir] base directory
* @return {Promise<string>}
*/
async function readTextFile(filePath: string, options: FsOptions = {}): Promise<string> {
return await promisified({
async function readTextFile(
filePath: string,
options: FsOptions = {}
): Promise<string> {
return await promisified<string>({
cmd: 'readTextFile',
path: filePath,
options
@ -61,15 +64,18 @@ async function readTextFile(filePath: string, options: FsOptions = {}): Promise<
}
/**
* reads a file as binary
*
* @param filePath path to the file
* @param {Object} [options] configuration object
* @name readBinaryFile
* @description Reads a file as binary
* @param {string} filePath path to the file
* @param {FsOptions} [options] configuration object
* @param {BaseDirectory} [options.dir] base directory
* @return {Promise<int[]>}
* @return {Promise<number[]>}
*/
async function readBinaryFile(filePath: string, options: FsOptions = {}): Promise<string> {
return await promisified({
async function readBinaryFile(
filePath: string,
options: FsOptions = {}
): Promise<number[]> {
return await promisified<number[]>({
cmd: 'readBinaryFile',
path: filePath,
options