pinokiod 0.1.69 → 0.1.70
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/kernel/api/fs/index.js +19 -3
- package/package.json +1 -1
package/kernel/api/fs/index.js
CHANGED
|
@@ -45,8 +45,19 @@ class FS {
|
|
|
45
45
|
/////////////////////////////////////////////////////////////////////////////
|
|
46
46
|
//
|
|
47
47
|
// 1. peer to peer shared drive
|
|
48
|
-
//
|
|
49
|
-
// 1.
|
|
48
|
+
//
|
|
49
|
+
// 1.1. With no peers
|
|
50
|
+
// {
|
|
51
|
+
// “method”: “fs.share”,
|
|
52
|
+
// “params”: {
|
|
53
|
+
// "drive": {
|
|
54
|
+
// “models/checkpoints": "app/models/checkpoints",
|
|
55
|
+
// “models/vae": "app/models/VAE",
|
|
56
|
+
// }
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
//
|
|
60
|
+
// 1.2. 1:1 Drive mapping (1 file path per 1 drive folder)
|
|
50
61
|
// {
|
|
51
62
|
// “method”: “fs.share”,
|
|
52
63
|
// “params”: {
|
|
@@ -59,7 +70,7 @@ class FS {
|
|
|
59
70
|
// }
|
|
60
71
|
//
|
|
61
72
|
//
|
|
62
|
-
//
|
|
73
|
+
// 1.3. 1:N Drive mapping (N file paths per 1 drive folder)
|
|
63
74
|
// {
|
|
64
75
|
// “method”: “fs.share”,
|
|
65
76
|
// “params”: {
|
|
@@ -88,7 +99,10 @@ class FS {
|
|
|
88
99
|
|
|
89
100
|
console.log("fs.share", req.params)
|
|
90
101
|
|
|
102
|
+
ondata({ raw: "\r\ncreating a shared drive:\r\n" + JSON.stringify(req.params, null, 2).replace(/\n/g, "\r\n") })
|
|
103
|
+
|
|
91
104
|
if (req.params.drive) {
|
|
105
|
+
if (req.params.peers
|
|
92
106
|
const drivePath = kernel.path("drive")
|
|
93
107
|
const drive = new Pdrive(drivePath)
|
|
94
108
|
for(const route in req.params.drive) {
|
|
@@ -141,6 +155,7 @@ class FS {
|
|
|
141
155
|
let cwd = (req.cwd ? req.cwd : kernel.api.userdir)
|
|
142
156
|
let filepath = path.resolve(cwd, req.params.path)
|
|
143
157
|
// await fs.promises.rm(filepath)
|
|
158
|
+
ondata({ raw: "\r\nremoving:\r\n" + filepath + "\r\n" })
|
|
144
159
|
await rimraf(filepath)
|
|
145
160
|
}
|
|
146
161
|
async copy(req, ondata, kernel) {
|
|
@@ -148,6 +163,7 @@ class FS {
|
|
|
148
163
|
let src = path.resolve(cwd, req.params.src)
|
|
149
164
|
let dest = path.resolve(cwd, req.params.dest)
|
|
150
165
|
let options = req.params.options
|
|
166
|
+
ondata({ raw: "\r\ncopying:\r\nfrom: " + src + "\r\nto: " + dest + "\r\n" })
|
|
151
167
|
await fs.promises.cp(src, dest, options)
|
|
152
168
|
}
|
|
153
169
|
|