import { requireLocal } from '../require' ; import * as nodefs from 'fs' ; import * as nodepath from 'path' ; const fs = requireLocal ( 'fs' ) ; const path = requireLocal ( 'path' ) ; export async function saveFile ( assetsPath , file ) { const fullPath = path . join ( assetsPath , file . path ) ; fs . promises . mkdir ( path . dirname ( fullPath ) , { recursive : true } ) ; await fs . promises . writeFile ( fullPath , file . content ) ; return 'successfully saved file to "' + fullPath + '"' ; }