|
@@ -12,6 +12,7 @@ var mime = require('mime-types'),
|
|
|
oncemore = require('oncemore'),
|
|
oncemore = require('oncemore'),
|
|
|
m3u8parse = require('m3u8parse'),
|
|
m3u8parse = require('m3u8parse'),
|
|
|
mkdirp = require('mkdirp'),
|
|
mkdirp = require('mkdirp'),
|
|
|
|
|
+ writeFileAtomic = require('write-file-atomic'),
|
|
|
debug = require('debug')('hls:recorder');
|
|
debug = require('debug')('hls:recorder');
|
|
|
|
|
|
|
|
// add custom extensions
|
|
// add custom extensions
|
|
@@ -216,7 +217,7 @@ HlsStreamRecorder.prototype.flushIndex = function(cb) {
|
|
|
if (appendString) {
|
|
if (appendString) {
|
|
|
fs.appendFile(path.join(this.dst, 'index.m3u8'), appendString, cb);
|
|
fs.appendFile(path.join(this.dst, 'index.m3u8'), appendString, cb);
|
|
|
} else {
|
|
} else {
|
|
|
- fs.writeFile(path.join(this.dst, 'index.m3u8'), indexString, cb);
|
|
|
|
|
|
|
+ writeFileAtomic(path.join(this.dst, 'index.m3u8'), indexString, cb);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|