bare-fs 2.2.2 → 2.3.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/binding.c CHANGED
@@ -7,6 +7,10 @@
7
7
  #include <utf.h>
8
8
  #include <uv.h>
9
9
 
10
+ #ifndef _MSC_VER
11
+ #include <unistd.h>
12
+ #endif
13
+
10
14
  /**
11
15
  * Per-thread singleton response handler that all file system requests
12
16
  * reference.
@@ -47,7 +51,7 @@ typedef struct {
47
51
  typedef uv_dirent_t bare_fs_dirent_t;
48
52
 
49
53
  static inline void
50
- on_fs_response (uv_fs_t *uv_req) {
54
+ bare_fs__on_response (uv_fs_t *uv_req) {
51
55
  int err;
52
56
 
53
57
  bare_fs_req_t *req = (bare_fs_req_t *) uv_req;
@@ -106,7 +110,7 @@ on_fs_response (uv_fs_t *uv_req) {
106
110
  }
107
111
 
108
112
  static void
109
- on_fs_stat_response (uv_fs_t *uv_req) {
113
+ bare_fs__on_stat_response (uv_fs_t *uv_req) {
110
114
  int err;
111
115
 
112
116
  bare_fs_req_t *req = (bare_fs_req_t *) uv_req;
@@ -166,11 +170,11 @@ on_fs_stat_response (uv_fs_t *uv_req) {
166
170
  assert(err == 0);
167
171
  }
168
172
 
169
- on_fs_response(uv_req);
173
+ bare_fs__on_response(uv_req);
170
174
  }
171
175
 
172
176
  static void
173
- on_fs_realpath_response (uv_fs_t *uv_req) {
177
+ bare_fs__on_realpath_response (uv_fs_t *uv_req) {
174
178
  int err;
175
179
 
176
180
  bare_fs_req_t *req = (bare_fs_req_t *) uv_req;
@@ -196,11 +200,11 @@ on_fs_realpath_response (uv_fs_t *uv_req) {
196
200
  assert(err == 0);
197
201
  }
198
202
 
199
- on_fs_response(uv_req);
203
+ bare_fs__on_response(uv_req);
200
204
  }
201
205
 
202
206
  static void
203
- on_fs_readlink_response (uv_fs_t *uv_req) {
207
+ bare_fs__on_readlink_response (uv_fs_t *uv_req) {
204
208
  int err;
205
209
 
206
210
  bare_fs_req_t *req = (bare_fs_req_t *) uv_req;
@@ -226,11 +230,11 @@ on_fs_readlink_response (uv_fs_t *uv_req) {
226
230
  assert(err == 0);
227
231
  }
228
232
 
229
- on_fs_response(uv_req);
233
+ bare_fs__on_response(uv_req);
230
234
  }
231
235
 
232
236
  static void
233
- on_fs_opendir_response (uv_fs_t *uv_req) {
237
+ bare_fs__on_opendir_response (uv_fs_t *uv_req) {
234
238
  int err;
235
239
 
236
240
  bare_fs_req_t *req = (bare_fs_req_t *) uv_req;
@@ -256,11 +260,11 @@ on_fs_opendir_response (uv_fs_t *uv_req) {
256
260
  assert(err == 0);
257
261
  }
258
262
 
259
- on_fs_response(uv_req);
263
+ bare_fs__on_response(uv_req);
260
264
  }
261
265
 
262
266
  static void
263
- on_fs_readdir_response (uv_fs_t *uv_req) {
267
+ bare_fs__on_readdir_response (uv_fs_t *uv_req) {
264
268
  int err;
265
269
 
266
270
  bare_fs_req_t *req = (bare_fs_req_t *) uv_req;
@@ -312,11 +316,11 @@ on_fs_readdir_response (uv_fs_t *uv_req) {
312
316
  assert(err == 0);
313
317
  }
314
318
 
315
- on_fs_response(uv_req);
319
+ bare_fs__on_response(uv_req);
316
320
  }
317
321
 
318
322
  static void
319
- on_fs_watcher_event (uv_fs_event_t *handle, const char *filename, int events, int status) {
323
+ bare_fs__on_watcher_event (uv_fs_event_t *handle, const char *filename, int events, int status) {
320
324
  int err;
321
325
 
322
326
  bare_fs_watcher_t *watcher = (bare_fs_watcher_t *) handle;
@@ -377,7 +381,7 @@ on_fs_watcher_event (uv_fs_event_t *handle, const char *filename, int events, in
377
381
  }
378
382
 
379
383
  static void
380
- on_fs_watcher_close (uv_handle_t *handle) {
384
+ bare_fs__on_watcher_close (uv_handle_t *handle) {
381
385
  int err;
382
386
 
383
387
  bare_fs_watcher_t *watcher = (bare_fs_watcher_t *) handle;
@@ -522,7 +526,7 @@ bare_fs_open (js_env_t *env, js_callback_info_t *info) {
522
526
  uv_loop_t *loop;
523
527
  js_get_env_loop(env, &loop);
524
528
 
525
- uv_fs_open(loop, (uv_fs_t *) req, (char *) path, flags, mode, on_fs_response);
529
+ uv_fs_open(loop, (uv_fs_t *) req, (char *) path, flags, mode, bare_fs__on_response);
526
530
 
527
531
  return NULL;
528
532
  }
@@ -594,7 +598,7 @@ bare_fs_close (js_env_t *env, js_callback_info_t *info) {
594
598
  uv_loop_t *loop;
595
599
  js_get_env_loop(env, &loop);
596
600
 
597
- uv_fs_close(loop, (uv_fs_t *) req, fd, on_fs_response);
601
+ uv_fs_close(loop, (uv_fs_t *) req, fd, bare_fs__on_response);
598
602
 
599
603
  return NULL;
600
604
  }
@@ -657,7 +661,7 @@ bare_fs_access (js_env_t *env, js_callback_info_t *info) {
657
661
  uv_loop_t *loop;
658
662
  js_get_env_loop(env, &loop);
659
663
 
660
- uv_fs_access(loop, (uv_fs_t *) req, (char *) path, mode, on_fs_response);
664
+ uv_fs_access(loop, (uv_fs_t *) req, (char *) path, mode, bare_fs__on_response);
661
665
 
662
666
  return NULL;
663
667
  }
@@ -742,7 +746,7 @@ bare_fs_read (js_env_t *env, js_callback_info_t *info) {
742
746
 
743
747
  uv_buf_t buf = uv_buf_init((void *) (data + offset), len);
744
748
 
745
- uv_fs_read(loop, (uv_fs_t *) req, fd, &buf, 1, pos, on_fs_response);
749
+ uv_fs_read(loop, (uv_fs_t *) req, fd, &buf, 1, pos, bare_fs__on_response);
746
750
 
747
751
  return NULL;
748
752
  }
@@ -848,7 +852,7 @@ bare_fs_readv (js_env_t *env, js_callback_info_t *info) {
848
852
  assert(err == 0);
849
853
  }
850
854
 
851
- uv_fs_read(loop, (uv_fs_t *) req, fd, bufs, bufs_len, pos, on_fs_response);
855
+ uv_fs_read(loop, (uv_fs_t *) req, fd, bufs, bufs_len, pos, bare_fs__on_response);
852
856
 
853
857
  free(bufs);
854
858
 
@@ -900,7 +904,7 @@ bare_fs_write (js_env_t *env, js_callback_info_t *info) {
900
904
 
901
905
  uv_buf_t buf = uv_buf_init((void *) (data + offset), len);
902
906
 
903
- uv_fs_write(loop, (uv_fs_t *) req, fd, &buf, 1, pos, on_fs_response);
907
+ uv_fs_write(loop, (uv_fs_t *) req, fd, &buf, 1, pos, bare_fs__on_response);
904
908
 
905
909
  return NULL;
906
910
  }
@@ -1006,7 +1010,7 @@ bare_fs_writev (js_env_t *env, js_callback_info_t *info) {
1006
1010
  assert(err == 0);
1007
1011
  }
1008
1012
 
1009
- uv_fs_write(loop, (uv_fs_t *) req, fd, bufs, bufs_len, pos, on_fs_response);
1013
+ uv_fs_write(loop, (uv_fs_t *) req, fd, bufs, bufs_len, pos, bare_fs__on_response);
1010
1014
 
1011
1015
  free(bufs);
1012
1016
 
@@ -1040,7 +1044,7 @@ bare_fs_ftruncate (js_env_t *env, js_callback_info_t *info) {
1040
1044
  uv_loop_t *loop;
1041
1045
  js_get_env_loop(env, &loop);
1042
1046
 
1043
- uv_fs_ftruncate(loop, (uv_fs_t *) req, fd, len, on_fs_response);
1047
+ uv_fs_ftruncate(loop, (uv_fs_t *) req, fd, len, bare_fs__on_response);
1044
1048
 
1045
1049
  return NULL;
1046
1050
  }
@@ -1072,7 +1076,7 @@ bare_fs_chmod (js_env_t *env, js_callback_info_t *info) {
1072
1076
  uv_loop_t *loop;
1073
1077
  js_get_env_loop(env, &loop);
1074
1078
 
1075
- uv_fs_chmod(loop, (uv_fs_t *) req, (char *) path, mode, on_fs_response);
1079
+ uv_fs_chmod(loop, (uv_fs_t *) req, (char *) path, mode, bare_fs__on_response);
1076
1080
 
1077
1081
  return NULL;
1078
1082
  }
@@ -1139,7 +1143,7 @@ bare_fs_fchmod (js_env_t *env, js_callback_info_t *info) {
1139
1143
  uv_loop_t *loop;
1140
1144
  js_get_env_loop(env, &loop);
1141
1145
 
1142
- uv_fs_fchmod(loop, (uv_fs_t *) req, fd, mode, on_fs_response);
1146
+ uv_fs_fchmod(loop, (uv_fs_t *) req, fd, mode, bare_fs__on_response);
1143
1147
 
1144
1148
  return NULL;
1145
1149
  }
@@ -1206,7 +1210,7 @@ bare_fs_rename (js_env_t *env, js_callback_info_t *info) {
1206
1210
  uv_loop_t *loop;
1207
1211
  js_get_env_loop(env, &loop);
1208
1212
 
1209
- uv_fs_rename(loop, (uv_fs_t *) req, (char *) src, (char *) dest, on_fs_response);
1213
+ uv_fs_rename(loop, (uv_fs_t *) req, (char *) src, (char *) dest, bare_fs__on_response);
1210
1214
 
1211
1215
  return NULL;
1212
1216
  }
@@ -1273,7 +1277,7 @@ bare_fs_mkdir (js_env_t *env, js_callback_info_t *info) {
1273
1277
  uv_loop_t *loop;
1274
1278
  js_get_env_loop(env, &loop);
1275
1279
 
1276
- uv_fs_mkdir(loop, (uv_fs_t *) req, (char *) path, mode, on_fs_response);
1280
+ uv_fs_mkdir(loop, (uv_fs_t *) req, (char *) path, mode, bare_fs__on_response);
1277
1281
 
1278
1282
  return NULL;
1279
1283
  }
@@ -1336,7 +1340,7 @@ bare_fs_rmdir (js_env_t *env, js_callback_info_t *info) {
1336
1340
  uv_loop_t *loop;
1337
1341
  js_get_env_loop(env, &loop);
1338
1342
 
1339
- uv_fs_rmdir(loop, (uv_fs_t *) req, (char *) path, on_fs_response);
1343
+ uv_fs_rmdir(loop, (uv_fs_t *) req, (char *) path, bare_fs__on_response);
1340
1344
 
1341
1345
  return NULL;
1342
1346
  }
@@ -1398,7 +1402,7 @@ bare_fs_stat (js_env_t *env, js_callback_info_t *info) {
1398
1402
  uv_loop_t *loop;
1399
1403
  js_get_env_loop(env, &loop);
1400
1404
 
1401
- uv_fs_stat(loop, (uv_fs_t *) req, (char *) path, on_fs_stat_response);
1405
+ uv_fs_stat(loop, (uv_fs_t *) req, (char *) path, bare_fs__on_stat_response);
1402
1406
 
1403
1407
  return NULL;
1404
1408
  }
@@ -1505,7 +1509,7 @@ bare_fs_lstat (js_env_t *env, js_callback_info_t *info) {
1505
1509
  uv_loop_t *loop;
1506
1510
  js_get_env_loop(env, &loop);
1507
1511
 
1508
- uv_fs_lstat(loop, (uv_fs_t *) req, (char *) path, on_fs_stat_response);
1512
+ uv_fs_lstat(loop, (uv_fs_t *) req, (char *) path, bare_fs__on_stat_response);
1509
1513
 
1510
1514
  return NULL;
1511
1515
  }
@@ -1612,7 +1616,7 @@ bare_fs_fstat (js_env_t *env, js_callback_info_t *info) {
1612
1616
  uv_loop_t *loop;
1613
1617
  js_get_env_loop(env, &loop);
1614
1618
 
1615
- uv_fs_fstat(loop, (uv_fs_t *) req, fd, on_fs_stat_response);
1619
+ uv_fs_fstat(loop, (uv_fs_t *) req, fd, bare_fs__on_stat_response);
1616
1620
 
1617
1621
  return NULL;
1618
1622
  }
@@ -1716,7 +1720,7 @@ bare_fs_unlink (js_env_t *env, js_callback_info_t *info) {
1716
1720
  uv_loop_t *loop;
1717
1721
  js_get_env_loop(env, &loop);
1718
1722
 
1719
- uv_fs_unlink(loop, (uv_fs_t *) req, (char *) path, on_fs_response);
1723
+ uv_fs_unlink(loop, (uv_fs_t *) req, (char *) path, bare_fs__on_response);
1720
1724
 
1721
1725
  return NULL;
1722
1726
  }
@@ -1778,7 +1782,7 @@ bare_fs_realpath (js_env_t *env, js_callback_info_t *info) {
1778
1782
  uv_loop_t *loop;
1779
1783
  js_get_env_loop(env, &loop);
1780
1784
 
1781
- uv_fs_realpath(loop, (uv_fs_t *) req, (char *) path, on_fs_realpath_response);
1785
+ uv_fs_realpath(loop, (uv_fs_t *) req, (char *) path, bare_fs__on_realpath_response);
1782
1786
 
1783
1787
  return NULL;
1784
1788
  }
@@ -1848,7 +1852,7 @@ bare_fs_readlink (js_env_t *env, js_callback_info_t *info) {
1848
1852
  uv_loop_t *loop;
1849
1853
  js_get_env_loop(env, &loop);
1850
1854
 
1851
- uv_fs_readlink(loop, (uv_fs_t *) req, (char *) path, on_fs_readlink_response);
1855
+ uv_fs_readlink(loop, (uv_fs_t *) req, (char *) path, bare_fs__on_readlink_response);
1852
1856
 
1853
1857
  return NULL;
1854
1858
  }
@@ -1921,7 +1925,7 @@ bare_fs_symlink (js_env_t *env, js_callback_info_t *info) {
1921
1925
  uv_loop_t *loop;
1922
1926
  js_get_env_loop(env, &loop);
1923
1927
 
1924
- uv_fs_symlink(loop, (uv_fs_t *) req, (char *) target, (char *) path, flags, on_fs_response);
1928
+ uv_fs_symlink(loop, (uv_fs_t *) req, (char *) target, (char *) path, flags, bare_fs__on_response);
1925
1929
 
1926
1930
  return NULL;
1927
1931
  }
@@ -1991,7 +1995,7 @@ bare_fs_opendir (js_env_t *env, js_callback_info_t *info) {
1991
1995
  uv_loop_t *loop;
1992
1996
  js_get_env_loop(env, &loop);
1993
1997
 
1994
- uv_fs_opendir(loop, (uv_fs_t *) req, (char *) path, on_fs_opendir_response);
1998
+ uv_fs_opendir(loop, (uv_fs_t *) req, (char *) path, bare_fs__on_opendir_response);
1995
1999
 
1996
2000
  return NULL;
1997
2001
  }
@@ -2069,7 +2073,7 @@ bare_fs_readdir (js_env_t *env, js_callback_info_t *info) {
2069
2073
  dir->dir->dirents = dirents;
2070
2074
  dir->dir->nentries = dirents_len / sizeof(bare_fs_dirent_t);
2071
2075
 
2072
- uv_fs_readdir(loop, (uv_fs_t *) req, dir->dir, on_fs_readdir_response);
2076
+ uv_fs_readdir(loop, (uv_fs_t *) req, dir->dir, bare_fs__on_readdir_response);
2073
2077
 
2074
2078
  return NULL;
2075
2079
  }
@@ -2168,7 +2172,7 @@ bare_fs_closedir (js_env_t *env, js_callback_info_t *info) {
2168
2172
  uv_loop_t *loop;
2169
2173
  js_get_env_loop(env, &loop);
2170
2174
 
2171
- uv_fs_closedir(loop, (uv_fs_t *) req, dir->dir, on_fs_response);
2175
+ uv_fs_closedir(loop, (uv_fs_t *) req, dir->dir, bare_fs__on_response);
2172
2176
 
2173
2177
  return NULL;
2174
2178
  }
@@ -2241,7 +2245,7 @@ bare_fs_watcher_init (js_env_t *env, js_callback_info_t *info) {
2241
2245
  return NULL;
2242
2246
  }
2243
2247
 
2244
- err = uv_fs_event_start(&watcher->handle, on_fs_watcher_event, (char *) path, recursive ? UV_FS_EVENT_RECURSIVE : 0);
2248
+ err = uv_fs_event_start(&watcher->handle, bare_fs__on_watcher_event, (char *) path, recursive ? UV_FS_EVENT_RECURSIVE : 0);
2245
2249
 
2246
2250
  if (err < 0) {
2247
2251
  js_throw_error(env, uv_err_name(err), uv_strerror(err));
@@ -2282,7 +2286,7 @@ bare_fs_watcher_close (js_env_t *env, js_callback_info_t *info) {
2282
2286
  err = uv_fs_event_stop(&watcher->handle);
2283
2287
  assert(err == 0);
2284
2288
 
2285
- uv_close((uv_handle_t *) &watcher->handle, on_fs_watcher_close);
2289
+ uv_close((uv_handle_t *) &watcher->handle, bare_fs__on_watcher_close);
2286
2290
 
2287
2291
  return NULL;
2288
2292
  }
@@ -2330,7 +2334,7 @@ bare_fs_watcher_unref (js_env_t *env, js_callback_info_t *info) {
2330
2334
  }
2331
2335
 
2332
2336
  static js_value_t *
2333
- init (js_env_t *env, js_value_t *exports) {
2337
+ bare_fs_exports (js_env_t *env, js_value_t *exports) {
2334
2338
  int err;
2335
2339
 
2336
2340
  {
@@ -2363,6 +2367,7 @@ init (js_env_t *env, js_value_t *exports) {
2363
2367
  js_create_uint32(env, sizeof(bare_fs_path_t), &val);
2364
2368
  js_set_named_property(env, exports, "sizeofFSPath", val);
2365
2369
  }
2370
+
2366
2371
  #define V(name, fn) \
2367
2372
  { \
2368
2373
  js_value_t *val; \
@@ -2515,4 +2520,4 @@ init (js_env_t *env, js_value_t *exports) {
2515
2520
  return exports;
2516
2521
  }
2517
2522
 
2518
- BARE_MODULE(bare_fs, init)
2523
+ BARE_MODULE(bare_fs, bare_fs_exports)
package/index.js CHANGED
@@ -1,11 +1,10 @@
1
1
  /* global Bare */
2
2
  const EventEmitter = require('bare-events')
3
- const os = require('bare-os')
4
3
  const path = require('bare-path')
5
- const { Readable, Writable } = require('streamx')
4
+ const { Readable, Writable } = require('bare-stream')
6
5
  const binding = require('./binding')
7
6
 
8
- const isWindows = os.platform() === 'win32'
7
+ const isWindows = Bare.platform === 'win32'
9
8
 
10
9
  const constants = exports.constants = {
11
10
  O_RDWR: binding.O_RDWR,
@@ -341,7 +340,7 @@ function readv (fd, buffers, pos, cb) {
341
340
  binding.readv(req.handle, fd, buffers, pos)
342
341
  }
343
342
 
344
- function write (fd, buffer, offset, len, pos, cb) {
343
+ function write (fd, data, offset, len, pos, cb) {
345
344
  if (typeof fd !== 'number') {
346
345
  throw typeError('ERR_INVALID_ARG_TYPE', 'File descriptor must be a number. Received type ' + (typeof fd) + ' (' + fd + ')')
347
346
  }
@@ -350,19 +349,45 @@ function write (fd, buffer, offset, len, pos, cb) {
350
349
  throw typeError('ERR_OUT_OF_RANGE', 'File descriptor is out of range. It must be >= 0 && <= 2147483647. Received ' + fd)
351
350
  }
352
351
 
353
- if (!Buffer.isBuffer(buffer) && !ArrayBuffer.isView(buffer)) {
354
- throw typeError('ERR_INVALID_ARG_TYPE', 'Buffer must be a buffer. Received type ' + (typeof buffer) + ' (' + buffer + ')')
352
+ if (typeof data !== 'string' && !Buffer.isBuffer(data) && !ArrayBuffer.isView(data)) {
353
+ throw typeError('ERR_INVALID_ARG_TYPE', 'Data must be a string or buffer. Received type ' + (typeof data))
355
354
  }
356
355
 
357
- if (typeof cb !== 'function') {
356
+ if (typeof data === 'string') {
357
+ let encoding = len
358
+ cb = pos
359
+ pos = offset
360
+
361
+ if (typeof cb !== 'function') {
362
+ if (typeof pos === 'function') {
363
+ cb = pos
364
+ pos = -1
365
+ encoding = 'utf8'
366
+ } else if (typeof encoding === 'function') {
367
+ cb = encoding
368
+ encoding = 'utf8'
369
+ } else {
370
+ throw typeError('ERR_INVALID_ARG_TYPE', 'Callback must be a function. Received type ' + (typeof cb) + ' (' + cb + ')')
371
+ }
372
+ }
373
+
374
+ if (typeof pos === 'string') {
375
+ encoding = pos
376
+ pos = -1
377
+ }
378
+
379
+ data = Buffer.from(data, encoding)
380
+ offset = 0
381
+ len = data.byteLength
382
+ } else if (typeof cb !== 'function') {
358
383
  if (typeof offset === 'function') {
359
384
  cb = offset
360
385
  offset = 0
361
- len = buffer.byteLength
386
+ len = data.byteLength
362
387
  pos = -1
363
388
  } else if (typeof len === 'function') {
364
389
  cb = len
365
- len = buffer.byteLength - offset
390
+ len = data.byteLength - offset
366
391
  pos = -1
367
392
  } else if (typeof pos === 'function') {
368
393
  cb = pos
@@ -376,10 +401,10 @@ function write (fd, buffer, offset, len, pos, cb) {
376
401
 
377
402
  const req = getReq()
378
403
  req.callback = cb
379
- binding.write(req.handle, fd, buffer, offset, len, pos)
404
+ binding.write(req.handle, fd, data, offset, len, pos)
380
405
  }
381
406
 
382
- function writeSync (fd, buffer, offset = 0, len = buffer.byteLength - offset, pos = -1) {
407
+ function writeSync (fd, data, offset = 0, len, pos) {
383
408
  if (typeof fd !== 'number') {
384
409
  throw typeError('ERR_INVALID_ARG_TYPE', 'File descriptor must be a number. Received type ' + (typeof fd) + ' (' + fd + ')')
385
410
  }
@@ -388,11 +413,17 @@ function writeSync (fd, buffer, offset = 0, len = buffer.byteLength - offset, po
388
413
  throw typeError('ERR_OUT_OF_RANGE', 'File descriptor is out of range. It must be >= 0 && <= 2147483647. Received ' + fd)
389
414
  }
390
415
 
391
- if (!Buffer.isBuffer(buffer) && !ArrayBuffer.isView(buffer)) {
392
- throw typeError('ERR_INVALID_ARG_TYPE', 'Buffer must be a buffer. Received type ' + (typeof buffer) + ' (' + buffer + ')')
416
+ if (typeof data !== 'string' && !Buffer.isBuffer(data) && !ArrayBuffer.isView(data)) {
417
+ throw typeError('ERR_INVALID_ARG_TYPE', 'Data must be a string or buffer. Received type ' + (typeof data))
393
418
  }
394
419
 
395
- return binding.writeSync(fd, buffer, offset, len, pos)
420
+ if (typeof data === 'string') data = Buffer.from(data)
421
+
422
+ if (typeof len !== 'number') len = data.byteLength - offset
423
+
424
+ if (typeof pos !== 'number') pos = -1
425
+
426
+ return binding.writeSync(fd, data, offset, len, pos)
396
427
  }
397
428
 
398
429
  function writev (fd, buffers, pos, cb) {
@@ -1256,7 +1287,7 @@ function writeFile (filepath, data, opts, cb) {
1256
1287
  }
1257
1288
 
1258
1289
  if (typeof data !== 'string' && !Buffer.isBuffer(data) && !ArrayBuffer.isView(data)) {
1259
- throw typeError('ERR_INVALID_ARG_TYPE', 'Data must be a string or buffer. Received type ' + (typeof data) + ' (' + data + ')')
1290
+ throw typeError('ERR_INVALID_ARG_TYPE', 'Data must be a string or buffer. Received type ' + (typeof data))
1260
1291
  }
1261
1292
 
1262
1293
  if (typeof opts === 'function') {
@@ -1303,7 +1334,7 @@ function writeFileSync (filepath, data, opts) {
1303
1334
  }
1304
1335
 
1305
1336
  if (typeof data !== 'string' && !Buffer.isBuffer(data) && !ArrayBuffer.isView(data)) {
1306
- throw typeError('ERR_INVALID_ARG_TYPE', 'Data must be a string or buffer. Received type ' + (typeof data) + ' (' + data + ')')
1337
+ throw typeError('ERR_INVALID_ARG_TYPE', 'Data must be a string or buffer. Received type ' + (typeof data))
1307
1338
  }
1308
1339
 
1309
1340
  if (typeof opts === 'string') opts = { encoding: opts }
@@ -1333,7 +1364,7 @@ function appendFile (filepath, data, opts, cb) {
1333
1364
  }
1334
1365
 
1335
1366
  if (typeof data !== 'string' && !Buffer.isBuffer(data) && !ArrayBuffer.isView(data)) {
1336
- throw typeError('ERR_INVALID_ARG_TYPE', 'Data must be a string or buffer. Received type ' + (typeof data) + ' (' + data + ')')
1367
+ throw typeError('ERR_INVALID_ARG_TYPE', 'Data must be a string or buffer. Received type ' + (typeof data))
1337
1368
  }
1338
1369
 
1339
1370
  if (typeof opts === 'function') {
@@ -1359,7 +1390,7 @@ function appendFileSync (filepath, data, opts) {
1359
1390
  }
1360
1391
 
1361
1392
  if (typeof data !== 'string' && !Buffer.isBuffer(data) && !ArrayBuffer.isView(data)) {
1362
- throw typeError('ERR_INVALID_ARG_TYPE', 'Data must be a string or buffer. Received type ' + (typeof data) + ' (' + data + ')')
1393
+ throw typeError('ERR_INVALID_ARG_TYPE', 'Data must be a string or buffer. Received type ' + (typeof data))
1363
1394
  }
1364
1395
 
1365
1396
  if (typeof opts === 'string') opts = { encoding: opts }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-fs",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "description": "Native file system for Javascript",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -27,9 +27,8 @@
27
27
  "homepage": "https://github.com/holepunchto/bare-fs#readme",
28
28
  "dependencies": {
29
29
  "bare-events": "^2.0.0",
30
- "bare-os": "^2.0.0",
31
30
  "bare-path": "^2.0.0",
32
- "streamx": "^2.13.0"
31
+ "bare-stream": "^1.0.0"
33
32
  },
34
33
  "devDependencies": {
35
34
  "brittle": "^3.1.1",
Binary file
Binary file
Binary file
Binary file
Binary file