File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import {
2626 getPath ,
2727 isNodeRuntime ,
2828 readBinaryFromInput ,
29+ writeBinaryToPath ,
2930} from '../utils/io' ;
3031import {
3132 extractAllButtonsForTranslation ,
@@ -747,20 +748,20 @@ class TouchChatProcessor extends BaseProcessor {
747748
748749 const outputZip = await this . options . zipAdapter ( ) ;
749750 const files : ZipFile [ ] = [ ] ;
750- for ( let entry of entries ) {
751+ for ( const entry of entries ) {
751752 if ( entry . entryName === vocabEntry . entryName ) {
752753 continue ;
753754 }
754755 const data = await entry . getData ( ) ;
755756 files . push ( {
756757 name : entry . entryName ,
757- data
758+ data,
758759 } ) ;
759- } ;
760+ }
760761 files . push ( {
761762 name : vocabEntry . entryName ,
762- data : fs . readFileSync ( dbPath )
763- } )
763+ data : fs . readFileSync ( dbPath ) ,
764+ } ) ;
764765 await outputZip . writeFiles ( files ) ;
765766 } finally {
766767 try {
@@ -1214,10 +1215,13 @@ class TouchChatProcessor extends BaseProcessor {
12141215 // Create zip file with the database
12151216 const zip = await this . options . zipAdapter ( ) ;
12161217 const data = fs . readFileSync ( dbPath ) ;
1217- zip . writeFiles ( [ {
1218- name : 'vocab.c4v' ,
1219- data
1220- } ] ) ;
1218+ const zipData = await zip . writeFiles ( [
1219+ {
1220+ name : 'vocab.c4v' ,
1221+ data,
1222+ } ,
1223+ ] ) ;
1224+ writeBinaryToPath ( outputPath , zipData ) ;
12211225 } finally {
12221226 // Clean up
12231227 if ( fs . existsSync ( tmpDir ) ) {
You can’t perform that action at this time.
0 commit comments