bare-fs 4.8.6 → 4.8.8

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/index.js CHANGED
@@ -1,4 +1,3 @@
1
- const FIFO = require('fast-fifo')
2
1
  const EventEmitter = require('bare-events')
3
2
  const path = require('bare-path')
4
3
  const { isURL, fileURLToPath } = require('bare-url')
@@ -6,6 +5,7 @@ const { Readable, Writable } = require('bare-stream')
6
5
  const binding = require('./binding')
7
6
  const constants = require('./lib/constants')
8
7
  const FileError = require('./lib/errors')
8
+ const Queue = require('./lib/queue')
9
9
 
10
10
  const isWindows = Bare.platform === 'win32'
11
11
 
@@ -1136,18 +1136,18 @@ function mkdirSync(filepath, opts) {
1136
1136
  }
1137
1137
 
1138
1138
  async function mkdtemp(prefix, cb) {
1139
- prefix = toNamespacedPath(prefix)
1139
+ prefix = toPath(prefix)
1140
1140
 
1141
1141
  const req = FileRequest.borrow()
1142
1142
 
1143
1143
  let res
1144
1144
  let err = null
1145
1145
  try {
1146
- binding.mkdtemp(req.handle, prefix + 'XXXXXX')
1146
+ binding.mkdtemp(req.handle, toNamespacedPath(prefix) + 'XXXXXX')
1147
1147
 
1148
1148
  await req
1149
1149
 
1150
- res = binding.requestResultPath(req.handle)
1150
+ res = prefix + binding.requestResultPath(req.handle).slice(-6)
1151
1151
  } catch (e) {
1152
1152
  err = new FileError(e.message, { operation: 'mkdtemp', code: e.code, path: prefix })
1153
1153
  } finally {
@@ -1158,14 +1158,14 @@ async function mkdtemp(prefix, cb) {
1158
1158
  }
1159
1159
 
1160
1160
  function mkdtempSync(prefix) {
1161
- prefix = toNamespacedPath(prefix)
1161
+ prefix = toPath(prefix)
1162
1162
 
1163
1163
  const req = FileRequest.borrow()
1164
1164
 
1165
1165
  try {
1166
- binding.mkdtempSync(req.handle, prefix + 'XXXXXX')
1166
+ binding.mkdtempSync(req.handle, toNamespacedPath(prefix) + 'XXXXXX')
1167
1167
 
1168
- return binding.requestResultPath(req.handle)
1168
+ return prefix + binding.requestResultPath(req.handle).slice(-6)
1169
1169
  } catch (e) {
1170
1170
  throw new FileError(e.message, { operation: 'mkdtempSync', code: e.code, path: prefix })
1171
1171
  } finally {
@@ -2250,7 +2250,7 @@ class Dir {
2250
2250
 
2251
2251
  this._encoding = encoding
2252
2252
  this._capacity = bufferSize
2253
- this._buffer = new FIFO()
2253
+ this._buffer = new Queue()
2254
2254
  this._ended = false
2255
2255
  this._handle = handle
2256
2256
  }
package/lib/queue.js ADDED
@@ -0,0 +1,29 @@
1
+ module.exports = class Queue {
2
+ constructor() {
3
+ this._items = []
4
+ this._head = 0
5
+ }
6
+
7
+ get length() {
8
+ return this._items.length - this._head
9
+ }
10
+
11
+ push(item) {
12
+ this._items.push(item)
13
+ }
14
+
15
+ shift() {
16
+ if (this._head === this._items.length) return undefined
17
+
18
+ const item = this._items[this._head]
19
+
20
+ this._items[this._head++] = undefined
21
+
22
+ if (this._head === this._items.length) {
23
+ this._items = []
24
+ this._head = 0
25
+ }
26
+
27
+ return item
28
+ }
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-fs",
3
- "version": "4.8.6",
3
+ "version": "4.8.8",
4
4
  "description": "Native file system operations for Bare",
5
5
  "exports": {
6
6
  "./package": "./package.json",
@@ -51,8 +51,7 @@
51
51
  "bare-events": "^2.5.4",
52
52
  "bare-path": "^3.0.0",
53
53
  "bare-stream": "^2.6.4",
54
- "bare-url": "^2.2.2",
55
- "fast-fifo": "^1.3.2"
54
+ "bare-url": "^2.2.2"
56
55
  },
57
56
  "devDependencies": {
58
57
  "bare-buffer": "^3.0.2",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file