StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
965 B
53 lines
965 B
'use strict';
|
|
|
|
var fs = require('graceful-fs');
|
|
var mkdirp = require('mkdirp');
|
|
|
|
var fo = require('../../fileOperations');
|
|
|
|
function writeDir(writePath, file, written) {
|
|
var mkdirpOpts = {
|
|
mode: file.stat.mode,
|
|
fs: fs,
|
|
};
|
|
mkdirp(writePath, mkdirpOpts, onMkdirp);
|
|
|
|
function onMkdirp(mkdirpErr) {
|
|
if (mkdirpErr) {
|
|
return written(mkdirpErr);
|
|
}
|
|
|
|
fs.open(writePath, 'r', onOpen);
|
|
}
|
|
|
|
function onOpen(openErr, fd) {
|
|
// If we don't have access, just move along
|
|
if (isInaccessible(openErr)) {
|
|
return fo.closeFd(null, fd, written);
|
|
}
|
|
|
|
if (openErr) {
|
|
return fo.closeFd(openErr, fd, written);
|
|
}
|
|
|
|
fo.updateMetadata(fd, file, onUpdate);
|
|
}
|
|
|
|
function onUpdate(statErr, fd) {
|
|
fo.closeFd(statErr, fd, written);
|
|
}
|
|
}
|
|
|
|
function isInaccessible(err) {
|
|
if (!err) {
|
|
return false;
|
|
}
|
|
|
|
if (err.code === 'EACCES') {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
module.exports = writeDir;
|
|
|