bare-fs 4.8.2 → 4.8.4

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
@@ -294,7 +294,7 @@ bare_fs_request_result_stat(js_env_t *env, js_callback_info_t *info) {
294
294
  uv_timespec_t time = req->handle.statbuf.st_##property; \
295
295
  \
296
296
  js_value_t *value; \
297
- err = js_create_int64(env, time.tv_sec * 1000 + time.tv_nsec / 1000000, &value); \
297
+ err = js_create_int64(env, (int64_t) time.tv_sec * 1000 + time.tv_nsec / 1000000, &value); \
298
298
  assert(err == 0); \
299
299
  \
300
300
  err = js_set_element(env, result, i++, value); \
package/index.js CHANGED
@@ -1469,6 +1469,20 @@ async function cp(src, dst, opts, cb) {
1469
1469
  } else if (st.isFile()) {
1470
1470
  await copyFile(src, dst)
1471
1471
  await chmod(dst, st.mode)
1472
+ } else if (st.isSymbolicLink()) {
1473
+ try {
1474
+ if (!(await lstat(dst)).isDirectory()) await unlink(dst)
1475
+ } catch (e) {
1476
+ if (e.code !== 'ENOENT') throw e
1477
+ }
1478
+
1479
+ await symlink(await readlink(src), dst)
1480
+ } else {
1481
+ throw new FileError('cannot copy a special file', {
1482
+ operation: 'cp',
1483
+ code: 'ENOTSUP',
1484
+ path: src
1485
+ })
1472
1486
  }
1473
1487
  } catch (e) {
1474
1488
  err = e
@@ -1503,6 +1517,20 @@ function cpSync(src, dst, opts = {}) {
1503
1517
  } else if (st.isFile()) {
1504
1518
  copyFileSync(src, dst)
1505
1519
  chmodSync(dst, st.mode)
1520
+ } else if (st.isSymbolicLink()) {
1521
+ try {
1522
+ if (!lstatSync(dst).isDirectory()) unlinkSync(dst)
1523
+ } catch (e) {
1524
+ if (e.code !== 'ENOENT') throw e
1525
+ }
1526
+
1527
+ symlinkSync(readlinkSync(src), dst)
1528
+ } else {
1529
+ throw new FileError('cannot copy a special file', {
1530
+ operation: 'cp',
1531
+ code: 'ENOTSUP',
1532
+ path: src
1533
+ })
1506
1534
  }
1507
1535
  }
1508
1536
 
@@ -1736,9 +1764,7 @@ async function symlink(target, filepath, type, cb) {
1736
1764
  target = path.resolve(filepath, '..', target)
1737
1765
 
1738
1766
  try {
1739
- type = (await stat(target)).isDirectory()
1740
- ? constants.UV_FS_SYMLINK_DIR
1741
- : constants.UV_FS_SYMLINK_JUNCTION
1767
+ type = (await stat(target)).isDirectory() ? constants.UV_FS_SYMLINK_DIR : 0
1742
1768
  } catch {
1743
1769
  type = 0
1744
1770
  }
@@ -1791,9 +1817,7 @@ function symlinkSync(target, filepath, type) {
1791
1817
  target = path.resolve(filepath, '..', target)
1792
1818
 
1793
1819
  try {
1794
- type = statSync(target).isDirectory()
1795
- ? constants.UV_FS_SYMLINK_DIR
1796
- : constants.UV_FS_SYMLINK_JUNCTION
1820
+ type = statSync(target).isDirectory() ? constants.UV_FS_SYMLINK_DIR : 0
1797
1821
  } catch {
1798
1822
  type = 0
1799
1823
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-fs",
3
- "version": "4.8.2",
3
+ "version": "4.8.4",
4
4
  "description": "Native file system operations for Bare",
5
5
  "exports": {
6
6
  "./package": "./package.json",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file