move export to the rust side to make the interface way more clean (#5855)
* move export Signed-off-by: Jess Frazelle <github@jessfraz.com> testing Signed-off-by: Jess Frazelle <github@jessfraz.com> remove debugs Signed-off-by: Jess Frazelle <github@jessfraz.com> fix main Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fices Signed-off-by: Jess Frazelle <github@jessfraz.com> get rid of logs Signed-off-by: Jess Frazelle <github@jessfraz.com> * Convert async actions anti-pattern to fromPromise actors * Fix tsc by removing a generic type * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup Signed-off-by: Jess Frazelle <github@jessfraz.com> * Update rustContext.ts * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix; Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup Signed-off-by: Jess Frazelle <github@jessfraz.com> * remove weird file Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import { isDesktop } from './isDesktop'
|
||||
import { deserialize_files } from '@rust/kcl-wasm-lib/pkg/kcl_wasm_lib'
|
||||
import { browserSaveFile } from './browserSaveFile'
|
||||
|
||||
import JSZip from 'jszip'
|
||||
@ -78,19 +77,14 @@ const save_ = async (file: ModelingAppFile, toastId: string) => {
|
||||
// Saves files locally from an export call.
|
||||
// We override the file's name with one passed in from the client side.
|
||||
export async function exportSave({
|
||||
data,
|
||||
files,
|
||||
fileName,
|
||||
toastId,
|
||||
}: {
|
||||
data: ArrayBuffer
|
||||
files: ModelingAppFile[]
|
||||
fileName: string
|
||||
toastId: string
|
||||
}) {
|
||||
// This converts the ArrayBuffer to a Rust equivalent Vec<u8>.
|
||||
let uintArray = new Uint8Array(data)
|
||||
|
||||
let files: ModelingAppFile[] = deserialize_files(uintArray)
|
||||
|
||||
if (files.length > 1) {
|
||||
let zip = new JSZip()
|
||||
for (const file of files) {
|
||||
|
Reference in New Issue
Block a user