@vbarbarosh/node-helpers 2.0.2 → 2.1.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/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": "2.0.2",
5
+ "version": "2.1.0",
6
6
  "description": "A set of helpers for JavaScript/Node.js",
7
7
  "files": [
8
8
  "src"
@@ -1,8 +1,8 @@
1
1
  const fs_read = require('./fs_read');
2
2
 
3
- async function fs_read_buffer(file)
3
+ function fs_read_buffer(file)
4
4
  {
5
- return await fs_read(file);
5
+ return fs_read(file);
6
6
  }
7
7
 
8
8
  module.exports = fs_read_buffer;
@@ -0,0 +1,10 @@
1
+ const fs_read = require('./fs_read');
2
+
3
+ // XXX Should support catchReturn, e.g.
4
+ // fs_read_lines(file).catchReturn(default_value)
5
+ function fs_read_lines(file)
6
+ {
7
+ return fs_read(file, {encoding: 'utf8'}).then(v => v.split('\n'));
8
+ }
9
+
10
+ module.exports = fs_read_lines;
@@ -1,8 +1,8 @@
1
1
  const fs_read = require('./fs_read');
2
2
 
3
- async function fs_read_utf8(file)
3
+ function fs_read_utf8(file)
4
4
  {
5
- return await fs_read(file, {encoding: 'utf8'});
5
+ return fs_read(file, {encoding: 'utf8'});
6
6
  }
7
7
 
8
8
  module.exports = fs_read_utf8;
@@ -0,0 +1,8 @@
1
+ const axios = require('axios');
2
+
3
+ async function http_put_utf8(url, utf8, options)
4
+ {
5
+ return axios.put(url, utf8, options).then(v => v.data);
6
+ }
7
+
8
+ module.exports = http_put_utf8;