@vbarbarosh/node-helpers 1.1.4 → 2.0.1

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.
Files changed (102) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/array_chunk.js +1 -1
  4. package/src/array_chunk.test.js +2 -2
  5. package/src/array_gcd.js +1 -1
  6. package/src/array_gcd.test.js +2 -2
  7. package/src/array_group.js +2 -2
  8. package/src/array_group_map.js +1 -1
  9. package/src/array_index.js +1 -1
  10. package/src/array_index.test.js +2 -2
  11. package/src/array_max.js +1 -1
  12. package/src/array_max.test.js +2 -2
  13. package/src/array_min.js +1 -1
  14. package/src/array_min.test.js +2 -2
  15. package/src/array_shuffle.js +1 -1
  16. package/src/array_sort.js +2 -2
  17. package/src/array_sort.test.js +2 -2
  18. package/src/array_sort_other.js +2 -2
  19. package/src/array_sort_other.test.js +2 -2
  20. package/src/array_sum.js +1 -1
  21. package/src/array_sum.test.js +2 -2
  22. package/src/array_unique_last.js +1 -1
  23. package/src/cli.js +8 -25
  24. package/src/crypto_decrypt_aes256.js +2 -2
  25. package/src/crypto_encrypt_aes256.js +2 -2
  26. package/src/crypto_encrypt_aes256.test.js +3 -3
  27. package/src/crypto_hash_md5.js +2 -2
  28. package/src/crypto_hash_sha256.js +2 -2
  29. package/src/crypto_hash_sha256.test.js +2 -2
  30. package/src/crypto_hmac_sha256.js +2 -2
  31. package/src/fcmp_dates.js +1 -1
  32. package/src/fcmp_numbers.js +1 -1
  33. package/src/fcmp_strings.js +1 -1
  34. package/src/format_thousands.js +1 -1
  35. package/src/fs_append.js +3 -3
  36. package/src/fs_append_json.js +3 -3
  37. package/src/fs_assert_file_exists.js +2 -2
  38. package/src/fs_assert_file_readable.js +2 -2
  39. package/src/fs_copy.js +3 -3
  40. package/src/fs_exists.js +2 -2
  41. package/src/fs_fclose.js +3 -3
  42. package/src/fs_fi.js +6 -6
  43. package/src/fs_find.js +5 -5
  44. package/src/fs_fopen.js +3 -3
  45. package/src/fs_fopen_update.js +2 -2
  46. package/src/fs_fread.js +3 -3
  47. package/src/fs_fsize.js +2 -2
  48. package/src/fs_fstat.js +3 -3
  49. package/src/fs_fwrite.js +3 -3
  50. package/src/fs_ls.js +5 -5
  51. package/src/fs_lsr.js +5 -5
  52. package/src/fs_lstat.js +3 -3
  53. package/src/fs_mkdir.js +3 -3
  54. package/src/fs_mkdirp.js +17 -11
  55. package/src/fs_mkdirp.test.js +15 -0
  56. package/src/fs_path_basename.js +2 -2
  57. package/src/fs_path_dirname.js +2 -2
  58. package/src/fs_path_join.js +2 -2
  59. package/src/fs_path_resolve.js +2 -2
  60. package/src/fs_path_sanitize.js +2 -2
  61. package/src/fs_path_tempdir.js +2 -2
  62. package/src/fs_read.js +3 -3
  63. package/src/fs_read_json.js +2 -2
  64. package/src/fs_read_stream.js +3 -1
  65. package/src/fs_read_utf8.js +2 -2
  66. package/src/fs_readdir.js +3 -3
  67. package/src/fs_readlink.js +3 -3
  68. package/src/fs_rename.js +3 -3
  69. package/src/fs_rm.js +3 -3
  70. package/src/fs_rmdir.js +3 -3
  71. package/src/fs_rmrf.js +7 -7
  72. package/src/fs_size.js +2 -2
  73. package/src/fs_tempdir.js +6 -6
  74. package/src/fs_write.js +3 -3
  75. package/src/fs_write_stream.js +3 -1
  76. package/src/http_delete.js +2 -2
  77. package/src/http_get_blob.js +2 -2
  78. package/src/http_get_buffer.js +2 -2
  79. package/src/http_get_file.js +6 -6
  80. package/src/http_get_json.js +2 -2
  81. package/src/http_patch_json.js +2 -2
  82. package/src/http_post_json.js +2 -2
  83. package/src/http_post_multipart.js +3 -3
  84. package/src/http_post_urlencoded.js +3 -3
  85. package/src/http_put_file.js +6 -6
  86. package/src/http_put_json.js +2 -2
  87. package/src/identity.js +1 -1
  88. package/src/ignore.js +1 -1
  89. package/src/json_stringify_stable.js +2 -2
  90. package/src/now_atom.js +1 -1
  91. package/src/random_int.js +6 -0
  92. package/src/redis_connect.js +21 -0
  93. package/src/redis_lshift.js +8 -0
  94. package/src/redis_poll.js +106 -0
  95. package/src/redis_poll_zshift_callback_rpush.js +141 -0
  96. package/src/redis_poll_zshift_spawn_rpush.js +159 -0
  97. package/src/redis_zshift.js +9 -0
  98. package/src/stream_data_ln.js +1 -1
  99. package/src/stream_data_ln.test.js +4 -4
  100. package/src/stream_promise.js +2 -2
  101. package/src/stream_promise.test.js +3 -3
  102. package/src/throttle.js +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@ A set of helpers for JavaScript/Node.js
2
2
 
3
3
  ## Installation
4
4
 
5
- npm install vbarbarosh/node-helpers
5
+ npm install @vbarbarosh/node-helpers
6
6
 
7
7
  ## Test
8
8
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Vladimir Barbarosh <vladimir.barbarosh@gmail.com>",
3
3
  "license": "MIT",
4
4
  "name": "@vbarbarosh/node-helpers",
5
- "version": "1.1.4",
5
+ "version": "2.0.1",
6
6
  "description": "A set of helpers for JavaScript/Node.js",
7
7
  "files": [
8
8
  "src"
@@ -18,4 +18,4 @@ function array_chunk(array = [], limit = 1)
18
18
  return out;
19
19
  }
20
20
 
21
- export default array_chunk;
21
+ module.exports = array_chunk;
@@ -1,5 +1,5 @@
1
- import array_chunk from './array_chunk';
2
- import assert from 'assert';
1
+ const array_chunk = require('./array_chunk');
2
+ const assert = require('assert');
3
3
 
4
4
  describe('array_chunk', function () {
5
5
  it('should accept no arguments', function () {
package/src/array_gcd.js CHANGED
@@ -13,4 +13,4 @@ function gcd(a, b)
13
13
  return a;
14
14
  }
15
15
 
16
- export default array_gcd;
16
+ module.exports = array_gcd;
@@ -1,5 +1,5 @@
1
- import array_gcd from './array_gcd';
2
- import assert from 'assert';
1
+ const array_gcd = require('./array_gcd');
2
+ const assert = require('assert');
3
3
 
4
4
  describe('array_gcd', function () {
5
5
  it('should handle basic input', function () {
@@ -1,4 +1,4 @@
1
- import array_group_map from './array_group_map';
1
+ const array_group_map = require('./array_group_map');
2
2
 
3
3
  /**
4
4
  * Group items by common key and return an array of groups.
@@ -12,4 +12,4 @@ function array_group(array, fn)
12
12
  return Object.values(array_group_map(array, fn));
13
13
  }
14
14
 
15
- export default array_group;
15
+ module.exports = array_group;
@@ -16,4 +16,4 @@ function array_group_map(array, fn)
16
16
  return out;
17
17
  }
18
18
 
19
- export default array_group_map;
19
+ module.exports = array_group_map;
@@ -5,4 +5,4 @@ function array_index(array, fn)
5
5
  return out;
6
6
  }
7
7
 
8
- export default array_index;
8
+ module.exports = array_index;
@@ -1,5 +1,5 @@
1
- import array_index from './array_index';
2
- import assert from 'assert';
1
+ const array_index = require('./array_index');
2
+ const assert = require('assert');
3
3
 
4
4
  describe('array_index', function () {
5
5
  it('should accept empty array', function () {
package/src/array_max.js CHANGED
@@ -23,4 +23,4 @@ function identity(value)
23
23
  return value;
24
24
  }
25
25
 
26
- export default array_max;
26
+ module.exports = array_max;
@@ -1,5 +1,5 @@
1
- import array_max from './array_max';
2
- import assert from 'assert';
1
+ const array_max = require('./array_max');
2
+ const assert = require('assert');
3
3
 
4
4
  describe('array_max', function () {
5
5
  it('should accept empty array', function () {
package/src/array_min.js CHANGED
@@ -23,4 +23,4 @@ function identity(value)
23
23
  return value;
24
24
  }
25
25
 
26
- export default array_min;
26
+ module.exports = array_min;
@@ -1,5 +1,5 @@
1
- import array_min from './array_min';
2
- import assert from 'assert';
1
+ const array_min = require('./array_min');
2
+ const assert = require('assert');
3
3
 
4
4
  describe('array_min', function () {
5
5
  it('should accept empty array', function () {
@@ -21,4 +21,4 @@ function array_shuffle(array)
21
21
  return array;
22
22
  }
23
23
 
24
- export default array_shuffle;
24
+ module.exports = array_shuffle;
package/src/array_sort.js CHANGED
@@ -1,4 +1,4 @@
1
- import fcmp_strings from './fcmp_strings';
1
+ const fcmp_strings = require('./fcmp_strings');
2
2
 
3
3
  /**
4
4
  * Sort items in an `array`.
@@ -20,4 +20,4 @@ function identity(v)
20
20
  return v;
21
21
  }
22
22
 
23
- export default array_sort;
23
+ module.exports = array_sort;
@@ -1,5 +1,5 @@
1
- import array_sort from './array_sort';
2
- import assert from 'assert';
1
+ const array_sort = require('./array_sort');
2
+ const assert = require('assert');
3
3
 
4
4
  describe('array_sort', function () {
5
5
  it('should handle basic input', function () {
@@ -1,4 +1,4 @@
1
- import fcmp_strings from './fcmp_strings';
1
+ const fcmp_strings = require('./fcmp_strings');
2
2
 
3
3
  /**
4
4
  * Sort items in an `array` at the same order as in `other`. Values which
@@ -30,4 +30,4 @@ function array_sort_other(array, fn, other, fcmp = fcmp_strings)
30
30
  });
31
31
  }
32
32
 
33
- export default array_sort_other;
33
+ module.exports = array_sort_other;
@@ -1,5 +1,5 @@
1
- import array_sort_other from './array_sort_other';
2
- import assert from 'assert';
1
+ const array_sort_other = require('./array_sort_other');
2
+ const assert = require('assert');
3
3
 
4
4
  describe('array_sort_other', function () {
5
5
  it('should handle basic input', function () {
package/src/array_sum.js CHANGED
@@ -7,4 +7,4 @@ function array_sum(array, fn = Number)
7
7
  return out;
8
8
  }
9
9
 
10
- export default array_sum;
10
+ module.exports = array_sum;
@@ -1,5 +1,5 @@
1
- import array_sum from './array_sum';
2
- import assert from 'assert';
1
+ const array_sum = require('./array_sum');
2
+ const assert = require('assert');
3
3
 
4
4
  describe('array_sum', function () {
5
5
  it('should handle basic input', function () {
@@ -25,4 +25,4 @@ function identity(value)
25
25
  return value;
26
26
  }
27
27
 
28
- export default array_unique_last;
28
+ module.exports = array_unique_last;
package/src/cli.js CHANGED
@@ -1,38 +1,21 @@
1
1
  /**
2
2
  * Entry point for Node CLI apps
3
- *
4
- * @link https://github.com/vbarbarosh/node-cli
5
3
  */
6
- async function cli(main)
4
+ function cli(main)
7
5
  {
8
6
  // https://stackoverflow.com/a/46916601/1478566
9
7
  const timer = setInterval(v => v, 1E9);
10
8
 
11
- try {
12
- return await main();
9
+ Promise.resolve(main()).then(resolve, reject);
10
+
11
+ function resolve() {
12
+ clearInterval(timer);
13
13
  }
14
- catch (error) {
14
+ function reject(error) {
15
+ clearInterval(timer);
15
16
  console.error(error);
16
17
  process.exit(1);
17
18
  }
18
- finally {
19
- clearInterval(timer);
20
- }
21
19
  }
22
20
 
23
- // import Promise from 'bluebird';
24
- //
25
- // // https://stackoverflow.com/a/57241059/1478566
26
- // function cli(main)
27
- // {
28
- // // https://stackoverflow.com/a/46916601/1478566
29
- // return Promise.method(main).call().catch(panic).finally(clearInterval.bind(null, setInterval(v=>v, 1E9)));
30
- // }
31
- //
32
- // function panic(error)
33
- // {
34
- // console.error(error);
35
- // process.exit(1);
36
- // }
37
-
38
- export default cli;
21
+ module.exports = cli;
@@ -1,4 +1,4 @@
1
- import crypto from 'crypto';
1
+ const crypto = require('crypto');
2
2
 
3
3
  /**
4
4
  * @link https://nodejs.org/api/crypto.html#crypto_class_cipher
@@ -13,4 +13,4 @@ function crypto_decrypt_aes256(password, ivenc)
13
13
  return Buffer.concat([decipher.update(enc), decipher.final()]);
14
14
  }
15
15
 
16
- export default crypto_decrypt_aes256;
16
+ module.exports = crypto_decrypt_aes256;
@@ -1,4 +1,4 @@
1
- import crypto from 'crypto';
1
+ const crypto = require('crypto');
2
2
 
3
3
  /**
4
4
  * @link https://nodejs.org/api/crypto.html#crypto_class_cipher
@@ -15,4 +15,4 @@ function crypto_encrypt_aes256(password, data)
15
15
  return Buffer.concat([Buffer.from([iv.length]), iv, cipher.update(data), cipher.final()]);
16
16
  }
17
17
 
18
- export default crypto_encrypt_aes256;
18
+ module.exports = crypto_encrypt_aes256;
@@ -1,6 +1,6 @@
1
- import assert from 'assert';
2
- import crypto_decrypt_aes256 from './crypto_decrypt_aes256';
3
- import crypto_encrypt_aes256 from './crypto_encrypt_aes256';
1
+ const assert = require('assert');
2
+ const crypto_decrypt_aes256 = require('./crypto_decrypt_aes256');
3
+ const crypto_encrypt_aes256 = require('./crypto_encrypt_aes256');
4
4
 
5
5
  describe('crypto_encrypt_aes256', function () {
6
6
  it('should handle basic input', function () {
@@ -1,4 +1,4 @@
1
- import crypto from 'crypto';
1
+ const crypto = require('crypto');
2
2
 
3
3
  /**
4
4
  *
@@ -11,4 +11,4 @@ function crypto_hash_md5(data)
11
11
  return crypto.createHash('md5').update(data).digest();
12
12
  }
13
13
 
14
- export default crypto_hash_md5;
14
+ module.exports = crypto_hash_md5;
@@ -1,4 +1,4 @@
1
- import crypto from 'crypto';
1
+ const crypto = require('crypto');
2
2
 
3
3
  /**
4
4
  *
@@ -11,4 +11,4 @@ function crypto_hash_sha256(data)
11
11
  return crypto.createHash('sha256').update(data).digest();
12
12
  }
13
13
 
14
- export default crypto_hash_sha256;
14
+ module.exports = crypto_hash_sha256;
@@ -1,5 +1,5 @@
1
- import crypto_hash_sha256 from './crypto_hash_sha256';
2
- import assert from 'assert';
1
+ const assert = require('assert');
2
+ const crypto_hash_sha256 = require('./crypto_hash_sha256');
3
3
 
4
4
  describe('crypto_hash_sha256', function () {
5
5
  it('should handle basic input', function () {
@@ -1,4 +1,4 @@
1
- import crypto from 'crypto';
1
+ const crypto = require('crypto');
2
2
 
3
3
  /**
4
4
  *
@@ -12,4 +12,4 @@ function crypto_hmac_sha256(password, data)
12
12
  return crypto.createHmac('sha256', password).update(data).digest();
13
13
  }
14
14
 
15
- export default crypto_hmac_sha256;
15
+ module.exports = crypto_hmac_sha256;
package/src/fcmp_dates.js CHANGED
@@ -3,4 +3,4 @@ function fcmp_dates(a, b)
3
3
  return a.getTime() - b.getTime();
4
4
  }
5
5
 
6
- export default fcmp_dates;
6
+ module.exports = fcmp_dates;
@@ -3,4 +3,4 @@ function fcmp_numbers(a, b)
3
3
  return Number(a) - b;
4
4
  }
5
5
 
6
- export default fcmp_numbers;
6
+ module.exports = fcmp_numbers;
@@ -3,4 +3,4 @@ function fcmp_strings(a, b)
3
3
  return String(a).localeCompare(b);
4
4
  }
5
5
 
6
- export default fcmp_strings;
6
+ module.exports = fcmp_strings;
@@ -4,4 +4,4 @@ function format_thousands(x)
4
4
  return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
5
5
  }
6
6
 
7
- export default format_thousands;
7
+ module.exports = format_thousands;
package/src/fs_append.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs from 'fs';
2
- import util from 'util';
1
+ const fs = require('fs');
2
+ const util = require('util');
3
3
 
4
4
  // https://nodejs.org/api/util.html#util_util_promisify_original
5
- export default util.promisify(fs.appendFile);
5
+ module.exports = util.promisify(fs.appendFile);
@@ -1,9 +1,9 @@
1
- import fs_append from './fs_append';
2
- import json_stringify_stable from './json_stringify_stable';
1
+ const fs_append = require('./fs_append');
2
+ const json_stringify_stable = require('./json_stringify_stable');
3
3
 
4
4
  function fs_append_json(file, value)
5
5
  {
6
6
  return fs_append(file, json_stringify_stable(value) + '\n');
7
7
  }
8
8
 
9
- export default fs_append_json;
9
+ module.exports = fs_append_json;
@@ -1,4 +1,4 @@
1
- import fs_fi from './fs_fi';
1
+ const fs_fi = require('./fs_fi');
2
2
 
3
3
  async function fs_assert_file_exists(file)
4
4
  {
@@ -8,4 +8,4 @@ async function fs_assert_file_exists(file)
8
8
  }
9
9
  }
10
10
 
11
- export default fs_assert_file_exists;
11
+ module.exports = fs_assert_file_exists;
@@ -1,4 +1,4 @@
1
- import fs_fi from './fs_fi';
1
+ const fs_fi = require('./fs_fi');
2
2
 
3
3
  async function fs_assert_file_readable(file)
4
4
  {
@@ -11,4 +11,4 @@ async function fs_assert_file_readable(file)
11
11
  }
12
12
  }
13
13
 
14
- export default fs_assert_file_readable;
14
+ module.exports = fs_assert_file_readable;
package/src/fs_copy.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs from 'fs';
2
- import util from 'util';
1
+ const fs = require('fs');
2
+ const util = require('util');
3
3
 
4
4
  // https://nodejs.org/api/util.html#util_util_promisify_original
5
- export default util.promisify(fs.copyFile);
5
+ module.exports = util.promisify(fs.copyFile);
package/src/fs_exists.js CHANGED
@@ -1,4 +1,4 @@
1
- import fs from 'fs';
1
+ const fs = require('fs');
2
2
 
3
3
  async function fs_exists(path)
4
4
  {
@@ -9,4 +9,4 @@ async function fs_exists(path)
9
9
  });
10
10
  }
11
11
 
12
- export default fs_exists;
12
+ module.exports = fs_exists;
package/src/fs_fclose.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs from 'fs';
2
- import util from 'util';
1
+ const fs = require('fs');
2
+ const util = require('util');
3
3
 
4
4
  // https://nodejs.org/api/util.html#util_util_promisify_original
5
- export default util.promisify(fs.close);
5
+ module.exports = util.promisify(fs.close);
package/src/fs_fi.js CHANGED
@@ -1,8 +1,8 @@
1
- import fs_lstat from './fs_lstat';
2
- import fs_path_basename from './fs_path_basename';
3
- import fs_path_dirname from './fs_path_dirname';
4
- import fs_path_resolve from './fs_path_resolve';
5
- import fs_readlink from './fs_readlink';
1
+ const fs_lstat = require('./fs_lstat');
2
+ const fs_path_basename = require('./fs_path_basename');
3
+ const fs_path_dirname = require('./fs_path_dirname');
4
+ const fs_path_resolve = require('./fs_path_resolve');
5
+ const fs_readlink = require('./fs_readlink');
6
6
 
7
7
  async function fs_fi(pathname)
8
8
  {
@@ -52,4 +52,4 @@ function flags(fi)
52
52
  tmp.forEach(key => fi.flags_map[key] = true);
53
53
  }
54
54
 
55
- export default fs_fi;
55
+ module.exports = fs_fi;
package/src/fs_find.js CHANGED
@@ -1,7 +1,7 @@
1
- import Promise from 'bluebird';
2
- import fs_fi from './fs_fi';
3
- import fs_path_resolve from './fs_path_resolve';
4
- import fs_readdir from './fs_readdir';
1
+ const Promise = require('bluebird');
2
+ const fs_fi = require('./fs_fi');
3
+ const fs_path_resolve = require('./fs_path_resolve');
4
+ const fs_readdir = require('./fs_readdir');
5
5
 
6
6
  async function fs_find(pathname = '.')
7
7
  {
@@ -18,4 +18,4 @@ async function fs_find(pathname = '.')
18
18
  return [fi];
19
19
  }
20
20
 
21
- export default fs_find;
21
+ module.exports = fs_find;
package/src/fs_fopen.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs from 'fs';
2
- import util from 'util';
1
+ const fs = require('fs');
2
+ const util = require('util');
3
3
 
4
4
  // https://nodejs.org/api/util.html#util_util_promisify_original
5
- export default util.promisify(fs.open);
5
+ module.exports = util.promisify(fs.open);
@@ -1,4 +1,4 @@
1
- import fs_fopen from './fs_fopen';
1
+ const fs_fopen = require('./fs_fopen');
2
2
 
3
3
  // Main use case is uploading files in chunks. Each time
4
4
  // a chunk is uploaded do update a target file. At the end
@@ -31,4 +31,4 @@ async function fs_fopen_update(pathname)
31
31
  return fs_fopen(pathname, 'r+');
32
32
  }
33
33
 
34
- export default fs_fopen_update;
34
+ module.exports = fs_fopen_update;
package/src/fs_fread.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs from 'fs';
2
- import util from 'util';
1
+ const fs = require('fs');
2
+ const util = require('util');
3
3
 
4
4
  // https://nodejs.org/api/util.html#util_util_promisify_original
5
5
  const read = util.promisify(fs.read);
@@ -12,4 +12,4 @@ async function fs_fread(fp, buffer, offset = null)
12
12
  return (bytesRead == buffer.length) ? buffer : buffer.slice(0, bytesRead);
13
13
  }
14
14
 
15
- export default fs_fread;
15
+ module.exports = fs_fread;
package/src/fs_fsize.js CHANGED
@@ -1,8 +1,8 @@
1
- import fs_fstat from './fs_fstat';
1
+ const fs_fstat = require('./fs_fstat');
2
2
 
3
3
  function fs_fsize(fp)
4
4
  {
5
5
  return fs_fstat(fp).then(v => v.size);
6
6
  }
7
7
 
8
- export default fs_fsize;
8
+ module.exports = fs_fsize;
package/src/fs_fstat.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs from 'fs';
2
- import util from 'util';
1
+ const fs = require('fs');
2
+ const util = require('util');
3
3
 
4
4
  // https://nodejs.org/api/util.html#util_util_promisify_original
5
- export default util.promisify(fs.fstat);
5
+ module.exports = util.promisify(fs.fstat);
package/src/fs_fwrite.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs from 'fs';
2
- import util from 'util';
1
+ const fs = require('fs');
2
+ const util = require('util');
3
3
 
4
4
  // https://nodejs.org/api/util.html#util_util_promisify_original
5
5
  const write = util.promisify(fs.write);
@@ -12,4 +12,4 @@ async function fs_fwrite(fp, buffer, offset = null)
12
12
  return bytesWritten;
13
13
  }
14
14
 
15
- export default fs_fwrite;
15
+ module.exports = fs_fwrite;
package/src/fs_ls.js CHANGED
@@ -1,7 +1,7 @@
1
- import Promise from 'bluebird';
2
- import fs_fi from './fs_fi';
3
- import fs_path_join from './fs_path_join';
4
- import fs_readdir from './fs_readdir';
1
+ const Promise = require('bluebird');
2
+ const fs_fi = require('./fs_fi');
3
+ const fs_path_join = require('./fs_path_join');
4
+ const fs_readdir = require('./fs_readdir');
5
5
 
6
6
  async function fs_ls(pathname = '.')
7
7
  {
@@ -13,4 +13,4 @@ async function fs_ls(pathname = '.')
13
13
  return [fi];
14
14
  }
15
15
 
16
- export default fs_ls;
16
+ module.exports = fs_ls;
package/src/fs_lsr.js CHANGED
@@ -1,7 +1,7 @@
1
- import Promise from 'bluebird';
2
- import fs_fi from './fs_fi';
3
- import fs_path_join from './fs_path_join';
4
- import fs_readdir from './fs_readdir';
1
+ const Promise = require('bluebird');
2
+ const fs_fi = require('./fs_fi');
3
+ const fs_path_join = require('./fs_path_join');
4
+ const fs_readdir = require('./fs_readdir');
5
5
 
6
6
  async function fs_lsr(pathname = '.')
7
7
  {
@@ -23,4 +23,4 @@ async function fs_lsr(pathname = '.')
23
23
  return ret;
24
24
  }
25
25
 
26
- export default fs_lsr;
26
+ module.exports = fs_lsr;
package/src/fs_lstat.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs from 'fs';
2
- import util from 'util';
1
+ const fs = require('fs');
2
+ const util = require('util');
3
3
 
4
4
  // https://nodejs.org/api/util.html#util_util_promisify_original
5
- export default util.promisify(fs.lstat);
5
+ module.exports = util.promisify(fs.lstat);
package/src/fs_mkdir.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs from 'fs';
2
- import util from 'util';
1
+ const fs = require('fs');
2
+ const util = require('util');
3
3
 
4
4
  // https://nodejs.org/api/util.html#util_util_promisify_original
5
- export default util.promisify(fs.mkdir);
5
+ module.exports = util.promisify(fs.mkdir);