mirror of
https://github.com/denoland/deno.git
synced 2025-09-29 13:44:47 +00:00
feat: URL support in Deno filesystem methods (#5990)
This commit is contained in:
parent
813210d433
commit
818a801092
28 changed files with 741 additions and 66 deletions
|
@ -1,17 +1,23 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
import { sendSync, sendAsync } from "../dispatch_json.ts";
|
||||
import { pathFromURL } from "../../util.ts";
|
||||
|
||||
export interface RemoveOptions {
|
||||
recursive?: boolean;
|
||||
}
|
||||
|
||||
export function removeSync(path: string, options: RemoveOptions = {}): void {
|
||||
export function removeSync(
|
||||
path: string | URL,
|
||||
options: RemoveOptions = {}
|
||||
): void {
|
||||
path = pathFromURL(path);
|
||||
sendSync("op_remove", { path, recursive: !!options.recursive });
|
||||
}
|
||||
|
||||
export async function remove(
|
||||
path: string,
|
||||
path: string | URL,
|
||||
options: RemoveOptions = {}
|
||||
): Promise<void> {
|
||||
path = pathFromURL(path);
|
||||
await sendAsync("op_remove", { path, recursive: !!options.recursive });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue