14 lines
311 B
JavaScript
14 lines
311 B
JavaScript
const convertDwgToPng = async (fileName, data) => {
|
|
console.log('fileName', fileName)
|
|
const imagePath = 'public/cad-images'
|
|
try {
|
|
await fs.readdir(imagePath)
|
|
} catch {
|
|
await fs.mkdir(imagePath)
|
|
}
|
|
|
|
return fs.writeFile(`${imagePath}/${fileName}`, data, 'base64')
|
|
}
|
|
|
|
export { convertDwgToPng }
|