@zenfs/dom 1.1.2 → 1.1.3
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/access.js +5 -6
- package/dist/xml.js +8 -9
- package/package.json +1 -1
package/dist/access.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Async, Errno, ErrnoError, FileSystem, InMemory, PreloadFile, Stats } from '@zenfs/core';
|
|
2
|
-
import {
|
|
3
|
-
import { basename, dirname, join } from '@zenfs/core/emulation/path.js';
|
|
1
|
+
import { Async, constants, Errno, ErrnoError, FileSystem, InMemory, PreloadFile, Stats } from '@zenfs/core';
|
|
2
|
+
import { basename, dirname, join } from '@zenfs/core/vfs/path.js';
|
|
4
3
|
import { convertException } from './utils.js';
|
|
5
4
|
function isResizable(buffer) {
|
|
6
5
|
if (buffer instanceof ArrayBuffer)
|
|
@@ -86,11 +85,11 @@ export class WebAccessFS extends Async(FileSystem) {
|
|
|
86
85
|
throw ErrnoError.With('ENOENT', path, 'stat');
|
|
87
86
|
}
|
|
88
87
|
if (handle instanceof FileSystemDirectoryHandle) {
|
|
89
|
-
return new Stats({ mode: 0o777 | S_IFDIR, size: 4096 });
|
|
88
|
+
return new Stats({ mode: 0o777 | constants.S_IFDIR, size: 4096 });
|
|
90
89
|
}
|
|
91
90
|
if (handle instanceof FileSystemFileHandle) {
|
|
92
91
|
const { lastModified, size } = await handle.getFile();
|
|
93
|
-
return new Stats({ mode: 0o777 | S_IFREG, size, mtimeMs: lastModified });
|
|
92
|
+
return new Stats({ mode: 0o777 | constants.S_IFREG, size, mtimeMs: lastModified });
|
|
94
93
|
}
|
|
95
94
|
throw new ErrnoError(Errno.EBADE, 'Handle is not a directory or file', path, 'stat');
|
|
96
95
|
}
|
|
@@ -103,7 +102,7 @@ export class WebAccessFS extends Async(FileSystem) {
|
|
|
103
102
|
throw convertException(ex, path, 'openFile');
|
|
104
103
|
});
|
|
105
104
|
const data = new Uint8Array(await file.arrayBuffer());
|
|
106
|
-
const stats = new Stats({ mode: 0o777 | S_IFREG, size: file.size, mtimeMs: file.lastModified });
|
|
105
|
+
const stats = new Stats({ mode: 0o777 | constants.S_IFREG, size: file.size, mtimeMs: file.lastModified });
|
|
107
106
|
return new PreloadFile(this, path, flag, stats, data);
|
|
108
107
|
}
|
|
109
108
|
async unlink(path) {
|
package/dist/xml.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { decodeRaw, encodeRaw, Errno, ErrnoError, FileSystem, PreloadFile, Stats, Sync } from '@zenfs/core';
|
|
2
|
-
import {
|
|
3
|
-
import { basename, dirname } from '@zenfs/core/emulation/path.js';
|
|
1
|
+
import { constants, decodeRaw, encodeRaw, Errno, ErrnoError, FileSystem, PreloadFile, Stats, Sync } from '@zenfs/core';
|
|
2
|
+
import { basename, dirname } from '@zenfs/core/vfs/path.js';
|
|
4
3
|
const statsLikeKeys = ['size', 'mode', 'atimeMs', 'mtimeMs', 'ctimeMs', 'birthtimeMs', 'uid', 'gid', 'ino', 'nlink'];
|
|
5
4
|
function get_stats(node) {
|
|
6
5
|
const stats = {};
|
|
@@ -63,9 +62,9 @@ export class XMLFS extends Sync(FileSystem) {
|
|
|
63
62
|
createFileSync(path, flag, mode, { uid, gid }) {
|
|
64
63
|
const parent = this.statSync(dirname(path));
|
|
65
64
|
const stats = new Stats({
|
|
66
|
-
mode: mode | S_IFREG,
|
|
67
|
-
uid: parent.mode & S_ISUID ? parent.uid : uid,
|
|
68
|
-
gid: parent.mode & S_ISGID ? parent.gid : gid,
|
|
65
|
+
mode: mode | constants.S_IFREG,
|
|
66
|
+
uid: parent.mode & constants.S_ISUID ? parent.uid : uid,
|
|
67
|
+
gid: parent.mode & constants.S_ISGID ? parent.gid : gid,
|
|
69
68
|
});
|
|
70
69
|
this.create('createFile', path, stats);
|
|
71
70
|
return new PreloadFile(this, path, flag, stats);
|
|
@@ -87,9 +86,9 @@ export class XMLFS extends Sync(FileSystem) {
|
|
|
87
86
|
mkdirSync(path, mode, { uid, gid }) {
|
|
88
87
|
const parent = this.statSync(dirname(path));
|
|
89
88
|
const node = this.create('mkdir', path, {
|
|
90
|
-
mode: mode | S_IFDIR,
|
|
91
|
-
uid: parent.mode & S_ISUID ? parent.uid : uid,
|
|
92
|
-
gid: parent.mode & S_ISGID ? parent.gid : gid,
|
|
89
|
+
mode: mode | constants.S_IFDIR,
|
|
90
|
+
uid: parent.mode & constants.S_ISUID ? parent.uid : uid,
|
|
91
|
+
gid: parent.mode & constants.S_ISGID ? parent.gid : gid,
|
|
93
92
|
});
|
|
94
93
|
node.textContent = '[]';
|
|
95
94
|
}
|