@@ -9,13 +9,8 @@ import * as fs from "node:fs";
99async function ffmpegDecodeToPng ( data , extname ) {
1010 return new Promise ( ( resolve , reject ) => {
1111 var fn = sharedLib . random . randomUUID ( ) ;
12- < << << << HEAD
1312 fs . writeFileSync ( `/ydpsys/tmp/${ fn } .${ extname } ` , data ) ;
1413 var ffmpeg = childProcess . spawn ( 'chroot' , [ '.' , 'ffmpeg' , '-i' , `/tmp/${ fn } .${ extname } ` , `/tmp/${ fn } .png` ] , { cwd :'/ydpsys' } ) ;
15- = === ===
16- fs . writeFileSync ( `${ process . env [ 'ydpSysRootPath' ] } /tmp/${ fn } .${ extname } ` , data ) ;
17- var ffmpeg = childProcess . spawn ( 'chroot' , [ '.' , 'ffmpeg' , '-i' , `/tmp/${ fn } .${ extname } ` , `/tmp/${ fn } .png` ] , { cwd :`${ process . env [ 'ydpSysRootPath' ] } ` } ) ;
18- > >>> >>> 5220509 ( init . )
1914 var outTxt = '' ;
2015 ffmpeg . stdout . on ( 'data' , ( d ) => {
2116 outTxt += String ( d ) ;
@@ -29,23 +24,13 @@ async function ffmpegDecodeToPng(data,extname){
2924 } else {
3025 console . log ( '[libPic] ffmpeg exit with code' , code , '. ' ) ;
3126 }
32- < << << << HEAD
3327 if ( ! fs . existsSync ( `/ydpsys/tmp/${ fn } .png` ) ) {
3428 reject ( outTxt ) ;
3529 return ;
3630 }
3731 var res = fs . readFileSync ( `/ydpsys/tmp/${ fn } .png` ) ;
3832 fs . unlinkSync ( `/ydpsys/tmp/${ fn } .png` ) ;
3933 fs . unlinkSync ( `/ydpsys/tmp/${ fn } .${ extname } ` ) ;
40- = === ===
41- if ( ! fs . existsSync ( `${ process . env [ 'ydpSysRootPath' ] } /tmp/${ fn } .png` ) ) {
42- reject ( outTxt ) ;
43- return ;
44- }
45- var res = fs . readFileSync ( `${ process . env [ 'ydpSysRootPath' ] } /tmp/${ fn } .png` ) ;
46- fs . unlinkSync ( `${ process . env [ 'ydpSysRootPath' ] } /tmp/${ fn } .png` ) ;
47- fs . unlinkSync ( `${ process . env [ 'ydpSysRootPath' ] } /tmp/${ fn } .${ extname } ` ) ;
48- > >>> >>> 5220509 ( init . )
4934 resolve ( res ) ;
5035 } ) ;
5136 } ) ;
@@ -154,10 +139,6 @@ export async function processPic(path) {
154139 data = await ffmpegDecodeToPng ( data , 'pic' ) ;
155140 img = await imageJs . Image . load ( data ) ;
156141 } catch ( ee ) {
157- < << << << HEAD
158- = === ===
159- console . log ( '[libPic] try ffmpeg failed. \n' , ee ) ;
160- > >>> >>> 5220509 ( init . )
161142 return {
162143 type : 'text/plain' ,
163144 buff :Buffer . from ( `${ url } \n${ JSON . stringify ( opt ) } \n${ ee } ` )
@@ -191,11 +172,7 @@ export async function processPic(path) {
191172 type : 'image/png'
192173 } ;
193174}
194- < << << << HEAD
195175export async function process ( Url , nowUrl , processServerHost , opt , svgOpt ) {
196- === = ===
197- export async function processLagacy ( Url , nowUrl , processServerHost , opt , svgOpt ) {
198- > >>> >>> 5220509 ( init . )
199176 return new Promise ( ( resolve , reject ) => {
200177 try {
201178 /*
0 commit comments