@archildata/just-bash 0.1.7 → 0.1.9
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/index.cjs +15 -19
- package/dist/index.js +15 -19
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -88,13 +88,13 @@ var init_ArchilFs = __esm({
|
|
|
88
88
|
const parts = normalizedPath.split("/").filter((p) => p !== "");
|
|
89
89
|
let currentInodeId = this.rootInodeId;
|
|
90
90
|
for (const part of parts) {
|
|
91
|
-
const response = await this.client.lookupInode(currentInodeId, part, this.user);
|
|
91
|
+
const response = await this.client.lookupInode(currentInodeId, part, { user: this.user });
|
|
92
92
|
if (response.inodeId === -1) {
|
|
93
93
|
throw new Error(`ENOENT: no such file or directory, '${path}'`);
|
|
94
94
|
}
|
|
95
95
|
currentInodeId = response.inodeId;
|
|
96
96
|
}
|
|
97
|
-
const attributes = await this.client.getAttributes(currentInodeId, this.user);
|
|
97
|
+
const attributes = await this.client.getAttributes(currentInodeId, { user: this.user });
|
|
98
98
|
return { inodeId: currentInodeId, attributes };
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
@@ -170,14 +170,14 @@ var init_ArchilFs = __esm({
|
|
|
170
170
|
}
|
|
171
171
|
const MAX_CHUNK = 4 * 1024 * 1024;
|
|
172
172
|
if (size <= MAX_CHUNK) {
|
|
173
|
-
const buffer = await this.client.readInode(inodeId, 0, size, this.user);
|
|
173
|
+
const buffer = await this.client.readInode(inodeId, 0, size, { user: this.user });
|
|
174
174
|
return new Uint8Array(buffer);
|
|
175
175
|
}
|
|
176
176
|
const result = new Uint8Array(size);
|
|
177
177
|
let offset = 0;
|
|
178
178
|
while (offset < size) {
|
|
179
179
|
const chunkSize = Math.min(MAX_CHUNK, size - offset);
|
|
180
|
-
const chunk = await this.client.readInode(inodeId, offset, chunkSize, this.user);
|
|
180
|
+
const chunk = await this.client.readInode(inodeId, offset, chunkSize, { user: this.user });
|
|
181
181
|
result.set(new Uint8Array(chunk), offset);
|
|
182
182
|
offset += chunkSize;
|
|
183
183
|
}
|
|
@@ -189,7 +189,7 @@ var init_ArchilFs = __esm({
|
|
|
189
189
|
if (attributes.inodeType !== "Directory") {
|
|
190
190
|
throw new Error(`ENOTDIR: not a directory, scandir '${path}'`);
|
|
191
191
|
}
|
|
192
|
-
const entries = await this.client.readDirectory(inodeId,
|
|
192
|
+
const entries = await this.client.readDirectory(inodeId, { user: this.user });
|
|
193
193
|
for (const e of entries) {
|
|
194
194
|
debug("readdir entry name=%j (bytes: %o)", e.name, Buffer.from(e.name));
|
|
195
195
|
}
|
|
@@ -200,7 +200,7 @@ var init_ArchilFs = __esm({
|
|
|
200
200
|
if (attributes.inodeType !== "Directory") {
|
|
201
201
|
throw new Error(`ENOTDIR: not a directory, scandir '${path}'`);
|
|
202
202
|
}
|
|
203
|
-
const entries = await this.client.readDirectory(inodeId,
|
|
203
|
+
const entries = await this.client.readDirectory(inodeId, { user: this.user });
|
|
204
204
|
return entries.filter((e) => e.name !== "." && e.name !== "..").map((e) => ({
|
|
205
205
|
name: e.name,
|
|
206
206
|
isFile: e.inodeType === "File",
|
|
@@ -246,7 +246,7 @@ var init_ArchilFs = __esm({
|
|
|
246
246
|
let resolvedPath = "/";
|
|
247
247
|
let currentInodeId = this.rootInodeId;
|
|
248
248
|
for (const part of parts) {
|
|
249
|
-
const response = await this.client.lookupInode(currentInodeId, part, this.user);
|
|
249
|
+
const response = await this.client.lookupInode(currentInodeId, part, { user: this.user });
|
|
250
250
|
if (response.inodeId === -1) {
|
|
251
251
|
throw new Error(`ENOENT: no such file or directory, realpath '${path}'`);
|
|
252
252
|
}
|
|
@@ -307,7 +307,7 @@ var init_ArchilFs = __esm({
|
|
|
307
307
|
rdev: void 0,
|
|
308
308
|
symlinkTarget: void 0
|
|
309
309
|
},
|
|
310
|
-
this.user
|
|
310
|
+
{ user: this.user }
|
|
311
311
|
);
|
|
312
312
|
debug("writeFile create succeeded inodeId=%d", inodeId);
|
|
313
313
|
} catch (createErr) {
|
|
@@ -316,7 +316,7 @@ var init_ArchilFs = __esm({
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
debug("writeFile writing %d bytes to inodeId=%d", data.length, inodeId);
|
|
319
|
-
await this.client.writeData(inodeId, 0, Buffer.from(data), this.user);
|
|
319
|
+
await this.client.writeData(inodeId, 0, Buffer.from(data), { user: this.user });
|
|
320
320
|
debug("writeFile write succeeded");
|
|
321
321
|
}
|
|
322
322
|
async appendFile(path, content) {
|
|
@@ -371,7 +371,7 @@ var init_ArchilFs = __esm({
|
|
|
371
371
|
rdev: void 0,
|
|
372
372
|
symlinkTarget: void 0
|
|
373
373
|
},
|
|
374
|
-
this.user
|
|
374
|
+
{ user: this.user }
|
|
375
375
|
);
|
|
376
376
|
}
|
|
377
377
|
async rm(path, options) {
|
|
@@ -394,7 +394,7 @@ var init_ArchilFs = __esm({
|
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
const { parentInodeId, name } = await this.resolveParent(path);
|
|
397
|
-
await this.client.unlink(parentInodeId, name, this.user);
|
|
397
|
+
await this.client.unlink(parentInodeId, name, { user: this.user });
|
|
398
398
|
}
|
|
399
399
|
async cp(src, dest, options) {
|
|
400
400
|
const srcResolved = await this.resolve(src);
|
|
@@ -424,7 +424,7 @@ var init_ArchilFs = __esm({
|
|
|
424
424
|
srcName,
|
|
425
425
|
destParentInodeId,
|
|
426
426
|
destName,
|
|
427
|
-
this.user
|
|
427
|
+
{ user: this.user }
|
|
428
428
|
);
|
|
429
429
|
}
|
|
430
430
|
async symlink(target, path) {
|
|
@@ -449,7 +449,7 @@ var init_ArchilFs = __esm({
|
|
|
449
449
|
rdev: void 0,
|
|
450
450
|
symlinkTarget: target
|
|
451
451
|
},
|
|
452
|
-
this.user
|
|
452
|
+
{ user: this.user }
|
|
453
453
|
);
|
|
454
454
|
}
|
|
455
455
|
async link(existingPath, newPath) {
|
|
@@ -459,11 +459,7 @@ var init_ArchilFs = __esm({
|
|
|
459
459
|
}
|
|
460
460
|
async chmod(path, mode) {
|
|
461
461
|
const { inodeId } = await this.resolve(path);
|
|
462
|
-
await this.client.setattr(
|
|
463
|
-
inodeId,
|
|
464
|
-
{ mode },
|
|
465
|
-
this.user ?? { uid: 0, gid: 0 }
|
|
466
|
-
);
|
|
462
|
+
await this.client.setattr(inodeId, { mode }, { user: this.user ?? { uid: 0, gid: 0 } });
|
|
467
463
|
}
|
|
468
464
|
async utimes(path, atime, mtime) {
|
|
469
465
|
debug("utimes path=%s atime=%d mtime=%d", path, atime, mtime);
|
|
@@ -475,7 +471,7 @@ var init_ArchilFs = __esm({
|
|
|
475
471
|
await this.client.setattr(
|
|
476
472
|
inodeId,
|
|
477
473
|
{ atimeMs, mtimeMs },
|
|
478
|
-
this.user ?? { uid: 0, gid: 0 }
|
|
474
|
+
{ user: this.user ?? { uid: 0, gid: 0 } }
|
|
479
475
|
);
|
|
480
476
|
debug("utimes setattr succeeded inodeId=%d", inodeId);
|
|
481
477
|
}
|
package/dist/index.js
CHANGED
|
@@ -77,13 +77,13 @@ var init_ArchilFs = __esm({
|
|
|
77
77
|
const parts = normalizedPath.split("/").filter((p) => p !== "");
|
|
78
78
|
let currentInodeId = this.rootInodeId;
|
|
79
79
|
for (const part of parts) {
|
|
80
|
-
const response = await this.client.lookupInode(currentInodeId, part, this.user);
|
|
80
|
+
const response = await this.client.lookupInode(currentInodeId, part, { user: this.user });
|
|
81
81
|
if (response.inodeId === -1) {
|
|
82
82
|
throw new Error(`ENOENT: no such file or directory, '${path}'`);
|
|
83
83
|
}
|
|
84
84
|
currentInodeId = response.inodeId;
|
|
85
85
|
}
|
|
86
|
-
const attributes = await this.client.getAttributes(currentInodeId, this.user);
|
|
86
|
+
const attributes = await this.client.getAttributes(currentInodeId, { user: this.user });
|
|
87
87
|
return { inodeId: currentInodeId, attributes };
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
@@ -159,14 +159,14 @@ var init_ArchilFs = __esm({
|
|
|
159
159
|
}
|
|
160
160
|
const MAX_CHUNK = 4 * 1024 * 1024;
|
|
161
161
|
if (size <= MAX_CHUNK) {
|
|
162
|
-
const buffer = await this.client.readInode(inodeId, 0, size, this.user);
|
|
162
|
+
const buffer = await this.client.readInode(inodeId, 0, size, { user: this.user });
|
|
163
163
|
return new Uint8Array(buffer);
|
|
164
164
|
}
|
|
165
165
|
const result = new Uint8Array(size);
|
|
166
166
|
let offset = 0;
|
|
167
167
|
while (offset < size) {
|
|
168
168
|
const chunkSize = Math.min(MAX_CHUNK, size - offset);
|
|
169
|
-
const chunk = await this.client.readInode(inodeId, offset, chunkSize, this.user);
|
|
169
|
+
const chunk = await this.client.readInode(inodeId, offset, chunkSize, { user: this.user });
|
|
170
170
|
result.set(new Uint8Array(chunk), offset);
|
|
171
171
|
offset += chunkSize;
|
|
172
172
|
}
|
|
@@ -178,7 +178,7 @@ var init_ArchilFs = __esm({
|
|
|
178
178
|
if (attributes.inodeType !== "Directory") {
|
|
179
179
|
throw new Error(`ENOTDIR: not a directory, scandir '${path}'`);
|
|
180
180
|
}
|
|
181
|
-
const entries = await this.client.readDirectory(inodeId,
|
|
181
|
+
const entries = await this.client.readDirectory(inodeId, { user: this.user });
|
|
182
182
|
for (const e of entries) {
|
|
183
183
|
debug("readdir entry name=%j (bytes: %o)", e.name, Buffer.from(e.name));
|
|
184
184
|
}
|
|
@@ -189,7 +189,7 @@ var init_ArchilFs = __esm({
|
|
|
189
189
|
if (attributes.inodeType !== "Directory") {
|
|
190
190
|
throw new Error(`ENOTDIR: not a directory, scandir '${path}'`);
|
|
191
191
|
}
|
|
192
|
-
const entries = await this.client.readDirectory(inodeId,
|
|
192
|
+
const entries = await this.client.readDirectory(inodeId, { user: this.user });
|
|
193
193
|
return entries.filter((e) => e.name !== "." && e.name !== "..").map((e) => ({
|
|
194
194
|
name: e.name,
|
|
195
195
|
isFile: e.inodeType === "File",
|
|
@@ -235,7 +235,7 @@ var init_ArchilFs = __esm({
|
|
|
235
235
|
let resolvedPath = "/";
|
|
236
236
|
let currentInodeId = this.rootInodeId;
|
|
237
237
|
for (const part of parts) {
|
|
238
|
-
const response = await this.client.lookupInode(currentInodeId, part, this.user);
|
|
238
|
+
const response = await this.client.lookupInode(currentInodeId, part, { user: this.user });
|
|
239
239
|
if (response.inodeId === -1) {
|
|
240
240
|
throw new Error(`ENOENT: no such file or directory, realpath '${path}'`);
|
|
241
241
|
}
|
|
@@ -296,7 +296,7 @@ var init_ArchilFs = __esm({
|
|
|
296
296
|
rdev: void 0,
|
|
297
297
|
symlinkTarget: void 0
|
|
298
298
|
},
|
|
299
|
-
this.user
|
|
299
|
+
{ user: this.user }
|
|
300
300
|
);
|
|
301
301
|
debug("writeFile create succeeded inodeId=%d", inodeId);
|
|
302
302
|
} catch (createErr) {
|
|
@@ -305,7 +305,7 @@ var init_ArchilFs = __esm({
|
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
307
|
debug("writeFile writing %d bytes to inodeId=%d", data.length, inodeId);
|
|
308
|
-
await this.client.writeData(inodeId, 0, Buffer.from(data), this.user);
|
|
308
|
+
await this.client.writeData(inodeId, 0, Buffer.from(data), { user: this.user });
|
|
309
309
|
debug("writeFile write succeeded");
|
|
310
310
|
}
|
|
311
311
|
async appendFile(path, content) {
|
|
@@ -360,7 +360,7 @@ var init_ArchilFs = __esm({
|
|
|
360
360
|
rdev: void 0,
|
|
361
361
|
symlinkTarget: void 0
|
|
362
362
|
},
|
|
363
|
-
this.user
|
|
363
|
+
{ user: this.user }
|
|
364
364
|
);
|
|
365
365
|
}
|
|
366
366
|
async rm(path, options) {
|
|
@@ -383,7 +383,7 @@ var init_ArchilFs = __esm({
|
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
const { parentInodeId, name } = await this.resolveParent(path);
|
|
386
|
-
await this.client.unlink(parentInodeId, name, this.user);
|
|
386
|
+
await this.client.unlink(parentInodeId, name, { user: this.user });
|
|
387
387
|
}
|
|
388
388
|
async cp(src, dest, options) {
|
|
389
389
|
const srcResolved = await this.resolve(src);
|
|
@@ -413,7 +413,7 @@ var init_ArchilFs = __esm({
|
|
|
413
413
|
srcName,
|
|
414
414
|
destParentInodeId,
|
|
415
415
|
destName,
|
|
416
|
-
this.user
|
|
416
|
+
{ user: this.user }
|
|
417
417
|
);
|
|
418
418
|
}
|
|
419
419
|
async symlink(target, path) {
|
|
@@ -438,7 +438,7 @@ var init_ArchilFs = __esm({
|
|
|
438
438
|
rdev: void 0,
|
|
439
439
|
symlinkTarget: target
|
|
440
440
|
},
|
|
441
|
-
this.user
|
|
441
|
+
{ user: this.user }
|
|
442
442
|
);
|
|
443
443
|
}
|
|
444
444
|
async link(existingPath, newPath) {
|
|
@@ -448,11 +448,7 @@ var init_ArchilFs = __esm({
|
|
|
448
448
|
}
|
|
449
449
|
async chmod(path, mode) {
|
|
450
450
|
const { inodeId } = await this.resolve(path);
|
|
451
|
-
await this.client.setattr(
|
|
452
|
-
inodeId,
|
|
453
|
-
{ mode },
|
|
454
|
-
this.user ?? { uid: 0, gid: 0 }
|
|
455
|
-
);
|
|
451
|
+
await this.client.setattr(inodeId, { mode }, { user: this.user ?? { uid: 0, gid: 0 } });
|
|
456
452
|
}
|
|
457
453
|
async utimes(path, atime, mtime) {
|
|
458
454
|
debug("utimes path=%s atime=%d mtime=%d", path, atime, mtime);
|
|
@@ -464,7 +460,7 @@ var init_ArchilFs = __esm({
|
|
|
464
460
|
await this.client.setattr(
|
|
465
461
|
inodeId,
|
|
466
462
|
{ atimeMs, mtimeMs },
|
|
467
|
-
this.user ?? { uid: 0, gid: 0 }
|
|
463
|
+
{ user: this.user ?? { uid: 0, gid: 0 } }
|
|
468
464
|
);
|
|
469
465
|
debug("utimes setattr succeeded inodeId=%d", inodeId);
|
|
470
466
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archildata/just-bash",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Archil filesystem adapter for just-bash",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"shell": "tsx bin/shell.ts"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@archildata/client": "^0.1.
|
|
29
|
+
"@archildata/client": "^0.1.10",
|
|
30
30
|
"commander": "^14.0.3",
|
|
31
31
|
"debug": "^4.3.4",
|
|
32
32
|
"just-bash": "^2.7.0"
|