Skip to content

Commit

Permalink
feat: add file size example
Browse files Browse the repository at this point in the history
  • Loading branch information
fu050409 committed Jul 12, 2024
1 parent 02d0464 commit ac987bb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './utils'
4 changes: 4 additions & 0 deletions src/types/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface FileSize {
size: number;
error?: string;
}
4 changes: 3 additions & 1 deletion src/views/index.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<script setup lang="ts">
import { invoke } from '@tauri-apps/api/core';
import { onMounted } from 'vue';
import { FileSize } from '../types';
onMounted(async () => {
const size: FileSize = await invoke('get_file_size', { url: 'https://freetestdata.com/wp-content/uploads/2021/09/1-MB-DOC.doc' })
console.log(size.error ? size.error : `File size: ${size.size}`);
})
</script>

Expand Down

0 comments on commit ac987bb

Please sign in to comment.