Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 1.07 KB

deno_api_del.md

File metadata and controls

32 lines (23 loc) · 1.07 KB

Deno删除操作API

API使用方式

更多详细信息可参考官方API文档 https://doc.deno.land/https/github.com/denoland/deno/releases/latest/download/lib.deno.d.ts#Deno.removeSync

同步删除操作

  • Deno.removeSync(path, {recursive})
    • path为要删除的地址
    • 参数配置里的recursiveboolean类型
      • recursive设置为true时候,即使path路径下是非空目录,也会递归删除掉目录里的所有内容。
Deno.removeSync('./assets/hello/world', {recursive: false})

异步删除操作

  • Deno.remove(path, {recursive})
    • path为要删除的地址
    • 参数配置里的recursiveboolean类型
      • recursive设置为true时候,即使path路径下是非空目录,也会递归删除掉目录里的所有内容。 返回一个Promise对象,回调为空void
async function main() {
  await Deno.remove('./assets/hello/world', {recursive: false});
}
main();