|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / dev / tools / grunt / tools / |
Filename | /home/dev2.destoffenstraat.com/dev/tools/grunt/tools/fs-tools.js |
Size | 1.3 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 28-Jan-2025 06:45 |
Last accessed | 21-Aug-2025 02:08 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
'use strict';
var fs = require('fs'),
glob = require('glob'),
nl = (function () {
if (process.platform === 'win32') {
return '\r\n';
}
return '\n';
})();
module.exports = {
getData: function (filePath) {
return this.parseToReadData(fs.readFileSync(filePath));
},
write: function (file, data) {
fs.writeFileSync(file, this.parseToWriteData(data));
console.log('The file was saved!');
},
read: function (filePath) {
console.log('Collect data from ' + filePath + ': Start!');
return glob.sync(filePath, {
symlinks: true
});
},
arrayRead: function (pathArr, callback) {
var len = pathArr.length,
data = [],
i = 0;
for (; i < len; i++) {
data = data.concat(this.read(pathArr[i]));
console.log('Collect data from ' + pathArr[i] + ': Finish!');
}
callback(data);
},
parseToReadData: function (data) {
var result = data.toString().split(nl);
result.pop();
return result;
},
parseToWriteData: function (data) {
data = data.join(nl) + nl;
return data;
}
};
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
'use strict';
var fs = require('fs'),
glob = require('glob'),
nl = (function () {
if (process.platform === 'win32') {
return '\r\n';
}
return '\n';
})();
module.exports = {
getData: function (filePath) {
return this.parseToReadData(fs.readFileSync(filePath));
},
write: function (file, data) {
fs.writeFileSync(file, this.parseToWriteData(data));
console.log('The file was saved!');
},
read: function (filePath) {
console.log('Collect data from ' + filePath + ': Start!');
return glob.sync(filePath, {
symlinks: true
});
},
arrayRead: function (pathArr, callback) {
var len = pathArr.length,
data = [],
i = 0;
for (; i < len; i++) {
data = data.concat(this.read(pathArr[i]));
console.log('Collect data from ' + pathArr[i] + ': Finish!');
}
callback(data);
},
parseToReadData: function (data) {
var result = data.toString().split(nl);
result.pop();
return result;
},
parseToWriteData: function (data) {
data = data.join(nl) + nl;
return data;
}
};