w-converhp 1.0.39 → 2.0.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/docs/index.html CHANGED
@@ -29,7 +29,7 @@
29
29
  <nav >
30
30
 
31
31
 
32
- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="WConverhpClient.html">WConverhpClient</a><ul class='methods'><li data-type='method'><a href="WConverhpClient.html#.broadcast">broadcast</a></li><li data-type='method'><a href="WConverhpClient.html#.deliver">deliver</a></li><li data-type='method'><a href="WConverhpClient.html#.execute">execute</a></li><li data-type='method'><a href="WConverhpClient.html#.onError">onError</a></li><li data-type='method'><a href="WConverhpClient.html#.onOpen">onOpen</a></li><li data-type='method'><a href="WConverhpClient.html#.onOpenOnce">onOpenOnce</a></li></ul></li><li><a href="WConverhpServer.html">WConverhpServer</a><ul class='methods'><li data-type='method'><a href="WConverhpServer.html#.broadcast">broadcast</a></li><li data-type='method'><a href="WConverhpServer.html#.deliver">deliver</a></li><li data-type='method'><a href="WConverhpServer.html#.onBroadcast">onBroadcast</a></li><li data-type='method'><a href="WConverhpServer.html#.onClientChange">onClientChange</a></li><li data-type='method'><a href="WConverhpServer.html#.onClientEnter">onClientEnter</a></li><li data-type='method'><a href="WConverhpServer.html#.onClientLeave">onClientLeave</a></li><li data-type='method'><a href="WConverhpServer.html#.onDeliver">onDeliver</a></li><li data-type='method'><a href="WConverhpServer.html#.onError">onError</a></li><li data-type='method'><a href="WConverhpServer.html#.onExecute">onExecute</a></li><li data-type='method'><a href="WConverhpServer.html#.onOpen">onOpen</a></li></ul></li></ul>
32
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="WConverhpClient.html">WConverhpClient</a></li><li><a href="WConverhpServer.html">WConverhpServer</a></li></ul>
33
33
 
34
34
  </nav>
35
35
 
@@ -71,7 +71,7 @@
71
71
  <br class="clear">
72
72
 
73
73
  <footer>
74
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed Mar 20 2024 23:49:04 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
74
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Mon Mar 03 2025 12:11:13 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
75
75
  </footer>
76
76
 
77
77
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "w-converhp",
3
- "version": "1.0.39",
3
+ "version": "2.0.0",
4
4
  "main": "dist/w-converhp-server.umd.js",
5
5
  "dependencies": {
6
- "@hapi/hapi": "^21.3.7",
6
+ "@hapi/hapi": "^21.3.12",
7
7
  "@hapi/inert": "^7.1.0",
8
- "axios": "^1.6.8",
8
+ "axios": "^1.8.1",
9
9
  "lodash-es": "^4.17.21",
10
- "wsemi": "^1.7.47"
10
+ "wsemi": "^1.7.70"
11
11
  },
12
12
  "devDependencies": {
13
- "form-data": "^4.0.0",
14
- "w-package-tools": "^1.0.73"
13
+ "form-data": "^4.0.2",
14
+ "w-package-tools": "^1.0.82"
15
15
  },
16
16
  "scripts": {
17
17
  "@hapi/hapi": "^20.2.1",
18
18
  "@hapi/inert": "^6.0.5",
19
- "test": "mocha --parallel --timeout 60000 --experimental-modules --es-module-specifier-resolution=node",
19
+ "test": "mocha --parallel --timeout 60000 --experimental-modules",
20
20
  "deploy": "gh-pages -d docs"
21
21
  },
22
22
  "repository": {
package/scla.mjs CHANGED
@@ -1,7 +1,7 @@
1
- // import fs from 'fs'
1
+ import fs from 'fs'
2
+ import w from 'wsemi'
2
3
  import FormData from 'form-data'
3
4
  import WConverhpClient from './src/WConverhpClient.mjs'
4
- // import WConverhpClient from './dist/w-converhp-client.umd.js' //編譯後axios與form-data都不適合執行於nodejs, 故需引用程式碼執行
5
5
 
6
6
 
7
7
  let opt = {
@@ -13,69 +13,51 @@ let opt = {
13
13
  //new
14
14
  let wo = new WConverhpClient(opt)
15
15
 
16
- wo.on('open', function() {
17
- console.log('client nodejs[port:8080]: open')
18
- })
19
- wo.on('openOnce', function() {
20
- console.log('client nodejs[port:8080]: openOnce')
16
+ async function execute(name, u8a) {
21
17
 
22
18
  //p
23
- let name = 'zdata.b1'
24
19
  let p = {
25
20
  a: 12,
26
21
  b: 34.56,
27
22
  c: 'test中文',
28
23
  d: {
29
- name: name,
30
- u8a: new Uint8Array([66, 97, 115]),
31
- // u8a: new Uint8Array(fs.readFileSync('../_data/500mb.7z')), //最多500mb, 因新版@hapi/pez無法處理1g檔案, 會出現: Invalid string length
32
- }
24
+ name,
25
+ u8a,
26
+ },
33
27
  }
28
+ console.log('p', p)
34
29
 
35
30
  //execute
36
- console.log('wo.execute')
37
- wo.execute('add', { p },
31
+ await wo.execute('add', { p },
38
32
  function (prog, p, m) {
39
- console.log('client nodejs[port:8080]: execute: prog', prog, p, m)
33
+ console.log('client web: execute: prog', prog, p, m)
40
34
  })
41
35
  .then(function(r) {
42
- console.log('client nodejs[port:8080]: execute: add', r)
36
+ console.log('client web: execute: add', r)
37
+ console.log('r._bin.name', r._bin.name, 'r._bin.u8a', r._bin.u8a)
38
+ // w.downloadFileFromU8Arr(r._bin.name, r._bin.u8a)
43
39
  })
44
- .catch(function(err) {
45
- console.log('client nodejs[port:8080]: execute: catch', err)
40
+ .catch(function (err) {
41
+ console.log('client web: execute: catch', err)
46
42
  })
47
43
 
48
- //broadcast
49
- wo.broadcast('client nodejs[port:8080] broadcast hi', function (prog) {
50
- console.log('client nodejs[port:8080]: broadcast: prog', prog)
51
- })
52
- .catch(function(err) {
53
- console.log('client nodejs[port:8080]: broadcast: catch', err)
54
- })
44
+ }
55
45
 
56
- //deliver
57
- wo.deliver('client nodejs[port:8080] deliver hi', function (prog) {
58
- console.log('client nodejs[port:8080]: deliver: prog', prog)
59
- })
60
- .catch(function(err) {
61
- console.log('client nodejs[port:8080]: deliver: catch', err)
62
- })
46
+ function executeWithU8a() {
47
+ let core = async() => {
48
+
49
+ //u8a
50
+ let u8a = new Uint8Array([66, 97, 115])
51
+ console.log('executeWithU8a u8a', u8a)
52
+
53
+ //execute
54
+ await execute('zdata.b1', u8a)
55
+
56
+ }
57
+ core()
58
+ }
59
+
60
+ executeWithU8a()
63
61
 
64
- })
65
- wo.on('close', function() {
66
- console.log('client nodejs[port:8080]: close')
67
- })
68
- wo.on('error', function(err) {
69
- console.log('client nodejs[port:8080]: error', err)
70
- })
71
- wo.on('reconn', function() {
72
- console.log('client nodejs[port:8080]: reconn')
73
- })
74
- wo.on('broadcast', function(data) {
75
- console.log('client nodejs[port:8080]: broadcast', data)
76
- })
77
- wo.on('deliver', function(data) {
78
- console.log('client nodejs[port:8080]: deliver', data)
79
- })
80
62
 
81
- //node --experimental-modules --es-module-specifier-resolution=node scla.mjs
63
+ //node --experimental-modules scla.mjs
package/sclb.mjs CHANGED
@@ -1,7 +1,7 @@
1
- //import fs from 'fs'
1
+ import fs from 'fs'
2
+ import w from 'wsemi'
2
3
  import FormData from 'form-data'
3
4
  import WConverhpClient from './src/WConverhpClient.mjs'
4
- // import WConverhpClient from './dist/w-converhp-client.umd.js' //編譯後axios與form-data都不適合執行於nodejs, 故需引用程式碼執行
5
5
 
6
6
 
7
7
  let opt = {
@@ -13,68 +13,51 @@ let opt = {
13
13
  //new
14
14
  let wo = new WConverhpClient(opt)
15
15
 
16
- wo.on('open', function() {
17
- console.log('client nodejs[port:8080]: open')
18
- })
19
- wo.on('openOnce', function() {
20
- console.log('client nodejs[port:8080]: openOnce')
16
+ async function execute(name, u8a) {
21
17
 
22
18
  //p
23
- let name = 'zdata.b1'
24
19
  let p = {
25
20
  a: 12,
26
21
  b: 34.56,
27
22
  c: 'test中文',
28
23
  d: {
29
- name: name,
30
- u8a: new Uint8Array([66, 97, 115]),
31
- //u8a: new Uint8Array(fs.readFileSync('/path/filename.txt')),
32
- }
24
+ name,
25
+ u8a,
26
+ },
33
27
  }
28
+ console.log('p', p)
34
29
 
35
30
  //execute
36
- wo.execute('add', { p },
31
+ await wo.execute('add', { p },
37
32
  function (prog, p, m) {
38
- console.log('client nodejs[port:8080]: execute: prog', prog, p, m)
33
+ console.log('client web: execute: prog', prog, p, m)
39
34
  })
40
35
  .then(function(r) {
41
- console.log('client nodejs[port:8080]: execute: add', r)
36
+ console.log('client web: execute: add', r)
37
+ console.log('r._bin.name', r._bin.name, 'r._bin.u8a', r._bin.u8a)
38
+ // w.downloadFileFromU8Arr(r._bin.name, r._bin.u8a)
42
39
  })
43
- .catch(function(err) {
44
- console.log('client nodejs[port:8080]: execute: catch', err)
40
+ .catch(function (err) {
41
+ console.log('client web: execute: catch', err)
45
42
  })
46
43
 
47
- //broadcast
48
- wo.broadcast('client nodejs[port:8080] broadcast hi', function (prog) {
49
- console.log('client nodejs[port:8080]: broadcast: prog', prog)
50
- })
51
- .catch(function(err) {
52
- console.log('client nodejs[port:8080]: broadcast: catch', err)
53
- })
44
+ }
54
45
 
55
- //deliver
56
- wo.deliver('client nodejs[port:8080] deliver hi', function (prog) {
57
- console.log('client nodejs[port:8080]: deliver: prog', prog)
58
- })
59
- .catch(function(err) {
60
- console.log('client nodejs[port:8080]: deliver: catch', err)
61
- })
46
+ function executeWithFile() {
47
+ let core = async() => {
48
+
49
+ //u8a
50
+ let u8a = new Uint8Array(fs.readFileSync('../_data/10mb.7z'))
51
+ console.log('executeWithFile u8a', u8a)
52
+
53
+ //execute
54
+ await execute('10mb.7z', u8a)
55
+
56
+ }
57
+ core()
58
+ }
59
+
60
+ executeWithFile()
62
61
 
63
- })
64
- wo.on('close', function() {
65
- console.log('client nodejs[port:8080]: close')
66
- })
67
- wo.on('error', function(err) {
68
- console.log('client nodejs[port:8080]: error', err)
69
- })
70
- wo.on('reconn', function() {
71
- console.log('client nodejs[port:8080]: reconn')
72
- })
73
- wo.on('broadcast', function(data) {
74
- console.log('client nodejs[port:8080]: broadcast', data)
75
- })
76
- wo.on('deliver', function(data) {
77
- console.log('client nodejs[port:8080]: deliver', data)
78
- })
79
62
 
80
- //node --experimental-modules --es-module-specifier-resolution=node sclb.mjs
63
+ //node --experimental-modules sclb.mjs
package/sclc.mjs ADDED
@@ -0,0 +1,42 @@
1
+ import fs from 'fs'
2
+ import w from 'wsemi'
3
+ import FormData from 'form-data'
4
+ import WConverhpClient from './src/WConverhpClient.mjs'
5
+
6
+
7
+ let opt = {
8
+ FormData,
9
+ url: 'http://localhost:8080',
10
+ apiName: 'api',
11
+ }
12
+
13
+ //new
14
+ let wo = new WConverhpClient(opt)
15
+
16
+ function uploadLargeFile() {
17
+ let core = async() => {
18
+
19
+ //u8a
20
+ let u8a = new Uint8Array(fs.readFileSync('../_data/1000mb.7z'))
21
+ console.log('u8a.length', u8a.length)
22
+ console.log('uploadLargeFile u8a', u8a)
23
+
24
+ await wo.upload('1000mb.7z', u8a,
25
+ function (prog, p, m) {
26
+ console.log('client web: upload: prog', prog, p, m)
27
+ })
28
+ .then(function(res) {
29
+ console.log('client web: upload: then', res)
30
+ })
31
+ .catch(function (err) {
32
+ console.log('client web: upload: catch', err)
33
+ })
34
+
35
+ }
36
+ core()
37
+ }
38
+
39
+ uploadLargeFile()
40
+
41
+
42
+ //node --experimental-modules sclc.mjs
package/script.txt ADDED
@@ -0,0 +1,18 @@
1
+ #node --experimental-modules toolg/addVersion.mjs
2
+ node --experimental-modules toolg/modifyReadme.mjs
3
+
4
+ node --experimental-modules toolg/cleanFolder.mjs
5
+ ./node_modules/.bin/jsdoc -c .jsdoc
6
+
7
+ node --experimental-modules toolg/gDistRollup.mjs
8
+
9
+ git add . -A
10
+ git commit -m 'modify: '
11
+ git push origin master:master
12
+
13
+ npm run deploy
14
+
15
+ #npm test
16
+
17
+ #npm publish
18
+