javascript - 将文件复制到新位置
问题描述
我正在尝试使用文件夹中的新文件中的数据复制文件。
我试过这样做,但没有奏效:
copyFile(`./data/guilddata/guilds/default/GUILDID.json`, `./data/guilddata/guilds/${guild.id}/GUILDID.json`, (err) => {
if (err) throw err;
});
https://www.npmjs.com/package/fs-copy-file
有谁知道该怎么做?(${guild.id}
仅表示公会ID,该文件夹已经存在)。我也没有错误。谢谢
解决方案
const fs = require('fs');
fs.copyFile('./data/guilddata/guilds/default/GUILDID.json', './data/guilddata/guilds/' + guild.id + '/GUILDID.json', (err) => {
if (err) throw err;
console.log('All done! The file is copied!');
});
推荐阅读
- java - 打印出来的结果是什么意思。Java 中的 System.nanoTime()
- flutter - 堆叠多个图标以使 IconButton 颤动
- windows - 如何打开 IOCTL 的设备驱动程序
- typescript - 从参数失败推断出的三元返回类型(Typescript)
- ios - 在 SwiftUI 的 List 行中添加形状
- php - 基于用户选择的动态列(Laravel)
- oracle-sqldeveloper - 我从 oracle sql dev 到 excel 的导出在 10% 后失败
- python - 在 Python Eurostat 中将年份列切换为一列
- linux - 如何在 Linux 上创建一个虚拟的“管道”伪串行设备?
- python - selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法找到元素: