Comments (5)
yes. it's not an doc-only issue.
If it's not an doc-only issue, could you please clarify what exactly the issue is?
from node.
import { copyFile, constants } from 'node:fs';
function callback(err) {
if (err) throw err;
console.log('source.txt was copied to destination.txt');
}
// destination.txt will be created or overwritten by default.
copyFile('source.txt', 'destination.txt', callback);
// By using COPYFILE_EXCL, the operation will fail if destination.txt exists.
copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL, callback);
The documentation mentions an err
argument in the callback demo code, but no where else in the docs, CC @nodejs/fs
from node.
From my test, fs.copyFile
's callback has a err
param.
$ node test.mjs
file:///test.mjs:4
if (err) throw err;
^
[Error: ENOENT: no such file or directory, copyfile 'source.txt' -> 'destination.txt'] {
errno: -2,
code: 'ENOENT',
syscall: 'copyfile',
path: 'source.txt',
dest: 'destination.txt'
}
Node.js v22.2.0
$ cat test.mjs
import { copyFile } from 'node:fs';
function callback(err) {
if (err) throw err;
console.log('source.txt was copied to destination.txt');
}
// destination.txt will be created or overwritten by default.
copyFile('source.txt', 'destination.txt', callback);
from node.
I ran the same code and got the same result, this seems like a doc-only issue. @Vikranthraosb is that was you were referring to?
from node.
yes. it's not an doc-only issue.
from node.
Related Issues (20)
- Adding 2 buttons to minimize the sidebars on nodejs > learn "docs" HOT 2
- Destructuring assignment in REPL throws `Uncaught TypeError: Cannot read properties of undefined (reading 'type')` HOT 2
- Timeout leaks when converted into a primitive and not cleared HOT 1
- Sk HOT 1
- issue tracker
- express.js
- vm module regression HOT 4
- Bot
- [20.14.0][fs] recursive watch on Linux crashes on `.close()` HOT 6
- Expose system errors HOT 1
- `new Array(2 ** 32)` makes let and const declarations that can't be initialized. HOT 18
- Customize password-based KDF in `KeyObject#export`
- Inaccurate windows stacktrace printer HOT 5
- INTERNAL COMPILER ERROR in GitHub Actions (Windows) HOT 3
- trace-atomics-wait doesn't propagate to workers when env is set HOT 6
- `process.argv` gets a different parsed value HOT 13
- Are primordials safe from monkeypatching the [Symbol.species] method? HOT 2
- Spacexxelon
- Test failures with OpenSSL 3.2.2 HOT 2
- GalaxyBot
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node.