bare-fs 4.1.6 → 4.2.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 +82 -0
- package/index.js +41 -0
- package/package.json +1 -1
- package/prebuilds/android-arm/bare-fs.bare +0 -0
- package/prebuilds/android-arm64/bare-fs.bare +0 -0
- package/prebuilds/android-ia32/bare-fs.bare +0 -0
- package/prebuilds/android-x64/bare-fs.bare +0 -0
- package/prebuilds/darwin-arm64/bare-fs.bare +0 -0
- package/prebuilds/darwin-x64/bare-fs.bare +0 -0
- package/prebuilds/ios-arm64/bare-fs.bare +0 -0
- package/prebuilds/ios-arm64-simulator/bare-fs.bare +0 -0
- package/prebuilds/ios-x64-simulator/bare-fs.bare +0 -0
- package/prebuilds/linux-arm64/bare-fs.bare +0 -0
- package/prebuilds/linux-x64/bare-fs.bare +0 -0
- package/prebuilds/win32-arm64/bare-fs.bare +0 -0
- package/prebuilds/win32-x64/bare-fs.bare +0 -0
package/binding.c
CHANGED
|
@@ -1183,6 +1183,86 @@ bare_fs_fchmod_sync(js_env_t *env, js_callback_info_t *info) {
|
|
|
1183
1183
|
return NULL;
|
|
1184
1184
|
}
|
|
1185
1185
|
|
|
1186
|
+
static js_value_t *
|
|
1187
|
+
bare_fs_utimes(js_env_t *env, js_callback_info_t *info) {
|
|
1188
|
+
int err;
|
|
1189
|
+
|
|
1190
|
+
size_t argc = 4;
|
|
1191
|
+
js_value_t *argv[4];
|
|
1192
|
+
|
|
1193
|
+
err = js_get_callback_info(env, info, &argc, argv, NULL, NULL);
|
|
1194
|
+
assert(err == 0);
|
|
1195
|
+
|
|
1196
|
+
assert(argc == 4);
|
|
1197
|
+
|
|
1198
|
+
bare_fs_t *req;
|
|
1199
|
+
err = js_get_arraybuffer_info(env, argv[0], (void **) &req, NULL);
|
|
1200
|
+
assert(err == 0);
|
|
1201
|
+
|
|
1202
|
+
req->active = true;
|
|
1203
|
+
|
|
1204
|
+
bare_fs_path_t path;
|
|
1205
|
+
err = js_get_value_string_utf8(env, argv[1], path, sizeof(bare_fs_path_t), NULL);
|
|
1206
|
+
assert(err == 0);
|
|
1207
|
+
|
|
1208
|
+
double atime;
|
|
1209
|
+
err = js_get_value_double(env, argv[2], &atime);
|
|
1210
|
+
assert(err == 0);
|
|
1211
|
+
|
|
1212
|
+
double mtime;
|
|
1213
|
+
err = js_get_value_double(env, argv[3], &mtime);
|
|
1214
|
+
assert(err == 0);
|
|
1215
|
+
|
|
1216
|
+
uv_loop_t *loop;
|
|
1217
|
+
err = js_get_env_loop(env, &loop);
|
|
1218
|
+
assert(err == 0);
|
|
1219
|
+
|
|
1220
|
+
uv_fs_utime(loop, &req->handle, (char *) path, atime, mtime, bare_fs__on_response);
|
|
1221
|
+
|
|
1222
|
+
return NULL;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
static js_value_t *
|
|
1226
|
+
bare_fs_utimes_sync(js_env_t *env, js_callback_info_t *info) {
|
|
1227
|
+
int err;
|
|
1228
|
+
|
|
1229
|
+
size_t argc = 3;
|
|
1230
|
+
js_value_t *argv[3];
|
|
1231
|
+
|
|
1232
|
+
err = js_get_callback_info(env, info, &argc, argv, NULL, NULL);
|
|
1233
|
+
assert(err == 0);
|
|
1234
|
+
|
|
1235
|
+
assert(argc == 3);
|
|
1236
|
+
|
|
1237
|
+
bare_fs_path_t path;
|
|
1238
|
+
err = js_get_value_string_utf8(env, argv[0], path, sizeof(bare_fs_path_t), NULL);
|
|
1239
|
+
assert(err == 0);
|
|
1240
|
+
|
|
1241
|
+
double atime;
|
|
1242
|
+
err = js_get_value_double(env, argv[1], &atime);
|
|
1243
|
+
assert(err == 0);
|
|
1244
|
+
|
|
1245
|
+
double mtime;
|
|
1246
|
+
err = js_get_value_double(env, argv[2], &mtime);
|
|
1247
|
+
assert(err == 0);
|
|
1248
|
+
|
|
1249
|
+
uv_loop_t *loop;
|
|
1250
|
+
err = js_get_env_loop(env, &loop);
|
|
1251
|
+
assert(err == 0);
|
|
1252
|
+
|
|
1253
|
+
uv_fs_t req;
|
|
1254
|
+
uv_fs_utime(loop, &req, (char *) path, atime, mtime, NULL);
|
|
1255
|
+
|
|
1256
|
+
if (req.result < 0) {
|
|
1257
|
+
err = js_throw_error(env, uv_err_name(req.result), uv_strerror(req.result));
|
|
1258
|
+
assert(err == 0);
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
uv_fs_req_cleanup(&req);
|
|
1262
|
+
|
|
1263
|
+
return NULL;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1186
1266
|
static js_value_t *
|
|
1187
1267
|
bare_fs_rename(js_env_t *env, js_callback_info_t *info) {
|
|
1188
1268
|
int err;
|
|
@@ -2659,6 +2739,8 @@ bare_fs_exports(js_env_t *env, js_value_t *exports) {
|
|
|
2659
2739
|
V("chmodSync", bare_fs_chmod_sync)
|
|
2660
2740
|
V("fchmod", bare_fs_fchmod)
|
|
2661
2741
|
V("fchmodSync", bare_fs_fchmod_sync)
|
|
2742
|
+
V("utimes", bare_fs_utimes)
|
|
2743
|
+
V("utimesSync", bare_fs_utimes_sync)
|
|
2662
2744
|
V("rename", bare_fs_rename)
|
|
2663
2745
|
V("renameSync", bare_fs_rename_sync)
|
|
2664
2746
|
V("copyfile", bare_fs_copyfile)
|
package/index.js
CHANGED
|
@@ -968,6 +968,44 @@ function fchmodSync(fd, mode) {
|
|
|
968
968
|
binding.fchmodSync(fd, mode)
|
|
969
969
|
}
|
|
970
970
|
|
|
971
|
+
function utimes(filepath, atime, mtime, cb) {
|
|
972
|
+
if (typeof filepath !== 'string') {
|
|
973
|
+
throw typeError(
|
|
974
|
+
'ERR_INVALID_ARG_TYPE',
|
|
975
|
+
'Path must be a string. Received type ' +
|
|
976
|
+
typeof filepath +
|
|
977
|
+
' (' +
|
|
978
|
+
filepath +
|
|
979
|
+
')'
|
|
980
|
+
)
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
if (typeof atime !== 'number') atime = atime.getTime() / 1000
|
|
984
|
+
if (typeof mtime !== 'number') mtime = mtime.getTime() / 1000
|
|
985
|
+
|
|
986
|
+
const req = getReq()
|
|
987
|
+
req.callback = cb
|
|
988
|
+
binding.utimes(req.handle, toNamespacedPath(filepath), atime, mtime)
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
function utimesSync(filepath, atime, mtime) {
|
|
992
|
+
if (typeof filepath !== 'string') {
|
|
993
|
+
throw typeError(
|
|
994
|
+
'ERR_INVALID_ARG_TYPE',
|
|
995
|
+
'Path must be a string. Received type ' +
|
|
996
|
+
typeof filepath +
|
|
997
|
+
' (' +
|
|
998
|
+
filepath +
|
|
999
|
+
')'
|
|
1000
|
+
)
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
if (typeof atime !== 'number') atime = atime.getTime() / 1000
|
|
1004
|
+
if (typeof mtime !== 'number') mtime = mtime.getTime() / 1000
|
|
1005
|
+
|
|
1006
|
+
binding.utimesSync(toNamespacedPath(filepath), atime, mtime)
|
|
1007
|
+
}
|
|
1008
|
+
|
|
971
1009
|
function mkdirRecursive(filepath, mode, cb) {
|
|
972
1010
|
filepath = toNamespacedPath(filepath)
|
|
973
1011
|
|
|
@@ -2645,6 +2683,7 @@ exports.rmdir = rmdir
|
|
|
2645
2683
|
exports.stat = stat
|
|
2646
2684
|
exports.symlink = symlink
|
|
2647
2685
|
exports.unlink = unlink
|
|
2686
|
+
exports.utimes = utimes
|
|
2648
2687
|
exports.watch = watch
|
|
2649
2688
|
exports.write = write
|
|
2650
2689
|
exports.writeFile = writeFile
|
|
@@ -2674,6 +2713,7 @@ exports.rmdirSync = rmdirSync
|
|
|
2674
2713
|
exports.statSync = statSync
|
|
2675
2714
|
exports.symlinkSync = symlinkSync
|
|
2676
2715
|
exports.unlinkSync = unlinkSync
|
|
2716
|
+
exports.utimesSync = utimesSync
|
|
2677
2717
|
exports.writeFileSync = writeFileSync
|
|
2678
2718
|
exports.writeSync = writeSync
|
|
2679
2719
|
|
|
@@ -2694,6 +2734,7 @@ exports.promises.rmdir = promisify(rmdir)
|
|
|
2694
2734
|
exports.promises.stat = promisify(stat)
|
|
2695
2735
|
exports.promises.symlink = promisify(symlink)
|
|
2696
2736
|
exports.promises.unlink = promisify(unlink)
|
|
2737
|
+
exports.promises.utimes = promisify(utimes)
|
|
2697
2738
|
exports.promises.writeFile = promisify(writeFile)
|
|
2698
2739
|
|
|
2699
2740
|
exports.promises.watch = watch // Already async iterable
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|