floating-live 0.8.6 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "floating-live",
3
- "version": "0.8.6",
3
+ "version": "0.8.7",
4
4
  "type": "commonjs",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -17,9 +17,11 @@
17
17
  "dependencies": {
18
18
  "acfun-live-danmaku": "^0.6.1",
19
19
  "axios": "^0.26.0",
20
- "bilibili-live-ws": "^6.0.3"
20
+ "bilibili-live-ws": "^6.0.3",
21
+ "fs-extra": "^11.1.0"
21
22
  },
22
23
  "devDependencies": {
24
+ "@types/fs-extra": "^9.0.13",
23
25
  "@types/websocket": "^1.0.5",
24
26
  "@types/ws": "^8.5.3",
25
27
  "rimraf": "^3.0.2",
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = __importDefault(require("fs"));
6
+ const fs_extra_1 = __importDefault(require("fs-extra"));
7
7
  class msgSave {
8
8
  constructor(main, type, file, open = true, config = { encoding: "utf8", flag: "a" }) {
9
9
  this.paused = !open;
@@ -16,7 +16,8 @@ class msgSave {
16
16
  this.main.on(this.type, this.listener);
17
17
  }
18
18
  write(message) {
19
- fs_1.default.writeFile(this.file, JSON.stringify(message) + ",", this.config, (err) => {
19
+ fs_extra_1.default.ensureFileSync(this.file);
20
+ fs_extra_1.default.writeFile(this.file, JSON.stringify(message) + ",", this.config, (err) => {
20
21
  if (err)
21
22
  throw err;
22
23
  // console.log('写入成功');