mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-08-04 21:39:04 +00:00
fix fs.writeFile in node 10+
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//start recording and share a list when required
|
||||
var zlib = require('zlib'),
|
||||
Datastore = require('nedb'),
|
||||
Datastore = require('nedb'),
|
||||
util = require("util"),
|
||||
path = require("path"),
|
||||
fs = require("fs"),
|
||||
@@ -31,17 +31,17 @@ function Recorder(option){
|
||||
logUtil.printLog("db file : " + option.filename);
|
||||
|
||||
}catch(e){
|
||||
logUtil.printLog(e, logUtil.T_ERR);
|
||||
logUtil.printLog(e, logUtil.T_ERR);
|
||||
logUtil.printLog("Failed to load on-disk db file. Will use in-meomory db instead.", logUtil.T_ERR);
|
||||
db = new Datastore();
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
//in-memory db
|
||||
db = new Datastore();
|
||||
}
|
||||
|
||||
self.recordBodyMap = []; // id - body
|
||||
self.recordBodyMap = []; // id - body
|
||||
|
||||
self.emitUpdate = function(id,info){
|
||||
if(info){
|
||||
@@ -100,7 +100,7 @@ function Recorder(option){
|
||||
//add to body map
|
||||
//ignore image data
|
||||
var bodyFile = path.join(cachePath,BODY_FILE_PRFIX + id);
|
||||
fs.writeFile(bodyFile, info.resBody);
|
||||
fs.writeFile(bodyFile, info.resBody, function() {});
|
||||
};
|
||||
|
||||
self.getBody = function(id,cb){
|
||||
|
||||
Reference in New Issue
Block a user