'use strict';
import { childProcessEvents } from '../../../../fd-toolbox/constants/child-process-events.js';
import _0x1869d0__default from 'path';
import { createWriteStream } from 'fs';
import { Readable } from 'stream';
import { getNewUuid } from '../../../../fd-toolbox/uuids.js';
import { mediaConstants } from '../../../meta/constants/media-constants.js';
import { fileExtensions } from '../../../../base-repo/app-constants/internal-system-constants.js';

var __defProp=Object['defineProperty'],__name=(_0x584061,_0x5839ec)=>__defProp(_0x584061,'name',{'value':_0x5839ec,'configurable':!![]});async function saveBlob(_0x4f62dc){const _0x3473d4=getNewUuid()+fileExtensions['png'],_0x4a4851=_0x1869d0__default['join'](mediaConstants['path'],_0x3473d4),_0x17680b=createWriteStream(_0x4a4851),_0x44a8b3=Readable['from']((async function*(){const _0x233e2b=_0x4f62dc['stream']()['getReader']();while(!![]){const {done:_0x2d3116,value:_0x2be86a}=await _0x233e2b['read']();if(_0x2d3116)break;yield _0x2be86a;}}()));return _0x44a8b3['pipe'](_0x17680b),new Promise((_0x3cfee4,_0x325428)=>{_0x17680b['on'](childProcessEvents['finish'],()=>_0x3cfee4(_0x3473d4)),_0x17680b['on'](childProcessEvents['error'],_0x325428);});}__name(saveBlob,'saveBlob');

export { saveBlob };
