@naturalcycles/nodejs-lib 13.6.0 → 13.7.0

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/dist/fs/fs2.d.ts CHANGED
@@ -33,6 +33,8 @@ declare class FS2 {
33
33
  writeJsonAsync(filePath: string, data: any, opt?: JsonOptions): Promise<void>;
34
34
  writeYaml(filePath: string, data: any, opt?: DumpOptions): void;
35
35
  writeYamlAsync(filePath: string, data: any, opt?: DumpOptions): Promise<void>;
36
+ appendFile(filePath: string, data: string | Buffer): void;
37
+ appendFileAsync(filePath: string, data: string | Buffer): Promise<void>;
36
38
  outputJson(filePath: string, data: any, opt?: JsonOptions): void;
37
39
  outputJsonAsync(filePath: string, data: any, opt?: JsonOptions): Promise<void>;
38
40
  outputYaml(filePath: string, data: any, opt?: DumpOptions): void;
@@ -57,6 +59,8 @@ declare class FS2 {
57
59
  * Cautious, underlying Node function is currently Experimental.
58
60
  */
59
61
  copyPathAsync(src: string, dest: string, opt?: fs.CopyOptions): Promise<void>;
62
+ renamePath(src: string, dest: string): void;
63
+ renamePathAsync(src: string, dest: string): Promise<void>;
60
64
  movePath(src: string, dest: string, opt?: fs.CopySyncOptions): void;
61
65
  movePathAsync(src: string, dest: string, opt?: fs.CopyOptions): Promise<void>;
62
66
  fs: typeof fs;
package/dist/fs/fs2.js CHANGED
@@ -105,6 +105,12 @@ class FS2 {
105
105
  const str = js_yaml_1.default.dump(data, opt);
106
106
  await promises_1.default.writeFile(filePath, str);
107
107
  }
108
+ appendFile(filePath, data) {
109
+ node_fs_1.default.appendFileSync(filePath, data);
110
+ }
111
+ async appendFileAsync(filePath, data) {
112
+ await promises_1.default.appendFile(filePath, data);
113
+ }
108
114
  outputJson(filePath, data, opt) {
109
115
  const str = stringify(data, opt);
110
116
  this.outputFile(filePath, str);
@@ -251,6 +257,12 @@ class FS2 {
251
257
  ...opt,
252
258
  });
253
259
  }
260
+ renamePath(src, dest) {
261
+ node_fs_1.default.renameSync(src, dest);
262
+ }
263
+ async renamePathAsync(src, dest) {
264
+ await promises_1.default.rename(src, dest);
265
+ }
254
266
  movePath(src, dest, opt) {
255
267
  this.copyPath(src, dest, opt);
256
268
  this.removePath(src);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
- "version": "13.6.0",
3
+ "version": "13.7.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "docs-serve": "vuepress dev docs",
package/src/fs/fs2.ts CHANGED
@@ -102,6 +102,14 @@ class FS2 {
102
102
  await fsp.writeFile(filePath, str)
103
103
  }
104
104
 
105
+ appendFile(filePath: string, data: string | Buffer): void {
106
+ fs.appendFileSync(filePath, data)
107
+ }
108
+
109
+ async appendFileAsync(filePath: string, data: string | Buffer): Promise<void> {
110
+ await fsp.appendFile(filePath, data)
111
+ }
112
+
105
113
  outputJson(filePath: string, data: any, opt?: JsonOptions): void {
106
114
  const str = stringify(data, opt)
107
115
  this.outputFile(filePath, str)
@@ -263,6 +271,14 @@ class FS2 {
263
271
  })
264
272
  }
265
273
 
274
+ renamePath(src: string, dest: string): void {
275
+ fs.renameSync(src, dest)
276
+ }
277
+
278
+ async renamePathAsync(src: string, dest: string): Promise<void> {
279
+ await fsp.rename(src, dest)
280
+ }
281
+
266
282
  movePath(src: string, dest: string, opt?: fs.CopySyncOptions): void {
267
283
  this.copyPath(src, dest, opt)
268
284
  this.removePath(src)