Closed Funi1234 closed 5 years ago
Hi,
The error message must come from rrd_info() as it cannot open a missing file and then since there was no error cleanup prior to calling the callback function, it carries on the error in create(). Does the create() create something in this case? However I will add an error cleanup to fix this soon. Thanks for the feedback.
Thierry
I ran into the same problem. A good alternative is to do :
var fs = require('fs')
filename = "/some/path/to/rrdfile.rrd";
if (!fs.existSync(filename)) {
// Create your database here
rrd.create(...);
} else {
console.log("Database exists ...");
// You can call rrd.info() here
}
Yes, that's the spirit. Thanks for sharing :)
When info() is called and the file doesnt exist it returns "{}". I'm trying to use this to indicate if the rrd file in questions exists.
If the file doesnt exist I then want to call the create() function to create it however an error is returned "opening 'someFile.rrd': No such file or directory".
The create() function alone works correctly and I've only encountered this when the call preceeding the create() is the info() call.
I thought maybe info() is locking the file or something similar but I'm unsure.