Added comlink.transfer to export
This commit is contained in:
parent
9cf2b35f1e
commit
7acb6bb161
@ -206,11 +206,12 @@ function ImportExportModal({ isOpen, onRequestClose }) {
|
||||
const tokenIds = checkedTokens.map((token) => token.id);
|
||||
|
||||
try {
|
||||
const blob = await worker.exportData(
|
||||
const buffer = await worker.exportData(
|
||||
Comlink.proxy(handleDBProgress),
|
||||
mapIds,
|
||||
tokenIds
|
||||
);
|
||||
const blob = new Blob([buffer]);
|
||||
saveAs(blob, `${shortid.generate()}.owlbear`);
|
||||
addSuccessToast("Exported", checkedMaps, checkedTokens);
|
||||
} catch (e) {
|
||||
|
@ -7,6 +7,7 @@ import {
|
||||
import { encode, decode } from "@msgpack/msgpack";
|
||||
|
||||
import { getDatabase } from "../database";
|
||||
import blobToBuffer from "../helpers/blobToBuffer";
|
||||
|
||||
// Worker to load large amounts of database data on a separate thread
|
||||
let service = {
|
||||
@ -92,7 +93,10 @@ let service = {
|
||||
numRowsPerChunk: 1,
|
||||
prettyJson: true,
|
||||
});
|
||||
return data;
|
||||
|
||||
const buffer = await blobToBuffer(data);
|
||||
|
||||
return Comlink.transfer(buffer, [buffer.buffer]);
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user