Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fs.readFile(localPath, 'utf-8', function(err, file) {
if (err) {
callback(err);
return;
}
var parsedZonefile = zonefile.parse(file);
var recordTypes = Object.keys(parsedZonefile);
var recordsToCreate = [];
recordTypes.forEach(function(recordType) {
var recordTypeSet = arrify(parsedZonefile[recordType]);
recordTypeSet.forEach(function(record) {
recordsToCreate.push(Record.fromZoneRecord_(self, recordType, record));
});
});
self.addRecords(recordsToCreate, callback);
});
};
fs.readFile(localPath, 'utf-8', (err, file) => {
if (err) {
callback(err);
return;
}
const parsedZonefile = zonefile.parse(file);
const defaultTTL = parsedZonefile.$ttl;
delete parsedZonefile.$ttl;
const recordTypes = Object.keys(parsedZonefile);
const recordsToCreate: Array<{}> = [];
recordTypes.forEach(recordType => {
const recordTypeSet = arrify(parsedZonefile[recordType]);
recordTypeSet.forEach(record => {
record.ttl = record.ttl || defaultTTL;
recordsToCreate.push(Record.fromZoneRecord_(this, recordType, record));
});
});
this.addRecords(recordsToCreate, callback);
});
}