bare-fs 4.5.6 → 4.7.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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bare-fs",
3
- "version": "4.5.6",
4
- "description": "Native file system operations for Javascript",
3
+ "version": "4.7.0",
4
+ "description": "Native file system operations for Bare",
5
5
  "exports": {
6
6
  "./package": "./package.json",
7
7
  ".": {
@@ -30,7 +30,9 @@
30
30
  ],
31
31
  "addon": true,
32
32
  "scripts": {
33
- "test": "prettier . --check && bare test.js"
33
+ "format": "prettier --write . && lunte --fix",
34
+ "lint": "prettier --check . && lunte",
35
+ "test": "brittle-bare --coverage test.js"
34
36
  },
35
37
  "repository": {
36
38
  "type": "git",
@@ -57,6 +59,7 @@
57
59
  "bare-crypto": "^1.11.2",
58
60
  "brittle": "^3.1.1",
59
61
  "cmake-bare": "^1.1.7",
62
+ "lunte": "^1.6.0",
60
63
  "prettier": "^3.4.1",
61
64
  "prettier-config-holepunch": "^2.0.0"
62
65
  },
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/promises.d.ts CHANGED
@@ -30,6 +30,8 @@ interface FileHandleEvents extends EventMap {
30
30
  }
31
31
 
32
32
  interface FileHandle extends EventEmitter<FileHandleEvents>, AsyncDisposable {
33
+ readonly fd: number
34
+
33
35
  close(): Promise<void>
34
36
 
35
37
  read(
@@ -54,6 +56,16 @@ interface FileHandle extends EventEmitter<FileHandleEvents>, AsyncDisposable {
54
56
 
55
57
  chmod(mode: string | number): Promise<void>
56
58
 
59
+ chown(uid: number, gid: number): Promise<void>
60
+
61
+ datasync(): Promise<void>
62
+
63
+ sync(): Promise<void>
64
+
65
+ truncate(len?: number): Promise<void>
66
+
67
+ utimes(atime: number | Date, mtime: number | Date): Promise<void>
68
+
57
69
  createReadStream(opts?: ReadStreamOptions): ReadStream
58
70
 
59
71
  createWriteStream(opts?: WriteStreamOptions): WriteStream
@@ -85,16 +97,26 @@ export function appendFile(
85
97
 
86
98
  export function chmod(filepath: Path, mode: string | number): Promise<void>
87
99
 
100
+ export function chown(filepath: Path, uid: number, gid: number): Promise<void>
101
+
88
102
  export function copyFile(src: Path, dst: Path, mode?: number): Promise<void>
89
103
 
90
104
  export function cp(src: Path, dst: Path, opts?: CpOptions): Promise<void>
91
105
 
106
+ export function lchown(filepath: Path, uid: number, gid: number): Promise<void>
107
+
108
+ export function lutimes(filepath: Path, atime: number | Date, mtime: number | Date): Promise<void>
109
+
110
+ export function link(src: Path, dst: Path): Promise<void>
111
+
92
112
  export function lstat(filepath: Path): Promise<Stats>
93
113
 
94
114
  export function mkdir(filepath: Path, opts?: MkdirOptions): Promise<void>
95
115
 
96
116
  export function mkdir(filepath: Path, mode: number): Promise<void>
97
117
 
118
+ export function mkdtemp(prefix: Path): Promise<string>
119
+
98
120
  export function opendir(
99
121
  filepath: Path,
100
122
  opts: OpendirOptions & { encoding?: BufferEncoding }
@@ -245,10 +267,16 @@ export function rmdir(filepath: Path): Promise<void>
245
267
 
246
268
  export function stat(filepath: Path): Promise<Stats>
247
269
 
270
+ export function statfs(filepath: Path): Promise<StatFs>
271
+
272
+ export function truncate(filepath: Path, len?: number): Promise<void>
273
+
248
274
  export function symlink(target: Path, filepath: Path, type?: string | number): Promise<void>
249
275
 
250
276
  export function unlink(filepath: Path): Promise<void>
251
277
 
278
+ export function utimes(filepath: Path, atime: number | Date, mtime: number | Date): Promise<void>
279
+
252
280
  export function watch(
253
281
  filepath: Path,
254
282
  opts: WatcherOptions & { encoding?: BufferEncoding }
package/promises.js CHANGED
@@ -3,11 +3,13 @@ const fs = require('.')
3
3
 
4
4
  class FileHandle extends EventEmitter {
5
5
  constructor(fd) {
6
+ super()
7
+
6
8
  this.fd = fd
7
9
  }
8
10
 
9
11
  async close() {
10
- await fs.close(fd)
12
+ await fs.close(this.fd)
11
13
 
12
14
  this.fd = -1
13
15
  this.emit('close')
@@ -49,6 +51,26 @@ class FileHandle extends EventEmitter {
49
51
  await fs.fchmod(this.fd, mode)
50
52
  }
51
53
 
54
+ async chown(uid, gid) {
55
+ await fs.fchown(this.fd, uid, gid)
56
+ }
57
+
58
+ async datasync() {
59
+ return fs.fdatasync(this.fd)
60
+ }
61
+
62
+ async sync() {
63
+ return fs.fsync(this.fd)
64
+ }
65
+
66
+ async truncate(len) {
67
+ await fs.ftruncate(this.fd, len)
68
+ }
69
+
70
+ async utimes(atime, mtime) {
71
+ await fs.futimes(this.fd, atime, mtime)
72
+ }
73
+
52
74
  createReadStream(opts) {
53
75
  return fs.createReadStream(null, { ...opts, fd: this.fd })
54
76
  }
@@ -69,11 +91,16 @@ exports.open = async function open(filepath, flags, mode) {
69
91
  exports.access = fs.access
70
92
  exports.appendFile = fs.appendFile
71
93
  exports.chmod = fs.chmod
94
+ exports.chown = fs.chown
72
95
  exports.constants = fs.constants
73
96
  exports.copyFile = fs.copyFile
74
97
  exports.cp = fs.cp
98
+ exports.lchown = fs.lchown
99
+ exports.lutimes = fs.lutimes
100
+ exports.link = fs.link
75
101
  exports.lstat = fs.lstat
76
102
  exports.mkdir = fs.mkdir
103
+ exports.mkdtemp = fs.mkdtemp
77
104
  exports.opendir = fs.opendir
78
105
  exports.readFile = fs.readFile
79
106
  exports.readdir = fs.readdir
@@ -83,6 +110,8 @@ exports.rename = fs.rename
83
110
  exports.rm = fs.rm
84
111
  exports.rmdir = fs.rmdir
85
112
  exports.stat = fs.stat
113
+ exports.statfs = fs.statfs
114
+ exports.truncate = fs.truncate
86
115
  exports.symlink = fs.symlink
87
116
  exports.unlink = fs.unlink
88
117
  exports.utimes = fs.utimes