1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-25 16:49:18 -05:00

fix(ext/node): use primordials in ext/node/polyfills/_fs/_fs_cp.js (#24320)

Towards #24236
This commit is contained in:
Asher Gomez 2024-06-24 16:17:26 +10:00 committed by GitHub
parent dc4a88b7a6
commit 0833a1617c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,15 +1,14 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file prefer-primordials
import { primordials } from "ext:core/mod.js";
import { op_node_cp, op_node_cp_sync } from "ext:core/ops";
import {
getValidatedPath,
validateCpOptions,
} from "ext:deno_node/internal/fs/utils.mjs";
import { promisify } from "ext:deno_node/internal/util.mjs";
const { PromisePrototypeThen } = primordials;
export function cpSync(src, dest, options) {
validateCpOptions(options);
const srcPath = getValidatedPath(src, "src");
@ -27,10 +26,11 @@ export function cp(src, dest, options, callback) {
const srcPath = getValidatedPath(src, "src");
const destPath = getValidatedPath(dest, "dest");
op_node_cp(
srcPath,
destPath,
).then(
PromisePrototypeThen(
op_node_cp(
srcPath,
destPath,
),
(res) => callback(null, res),
(err) => callback(err, null),
);