first commit

This commit is contained in:
Stefan Hacker
2026-04-03 09:38:48 +02:00
commit 37ad745546
47450 changed files with 3120798 additions and 0 deletions
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2026 Vadims @streamich Daleckis <vadimsdaleckis@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+3
View File
@@ -0,0 +1,3 @@
# Node.js `fs` Utilities
Utility functions and constants for working with Node.js `fs`-like modules.
+108
View File
@@ -0,0 +1,108 @@
export declare const SEP = "/";
export declare const enum PATH {
SEP = "/"
}
export declare const constants: {
O_RDONLY: number;
O_WRONLY: number;
O_RDWR: number;
S_IFMT: number;
S_IFREG: number;
S_IFDIR: number;
S_IFCHR: number;
S_IFBLK: number;
S_IFIFO: number;
S_IFLNK: number;
S_IFSOCK: number;
O_CREAT: number;
O_EXCL: number;
O_NOCTTY: number;
O_TRUNC: number;
O_APPEND: number;
O_DIRECTORY: number;
O_NOATIME: number;
O_NOFOLLOW: number;
O_SYNC: number;
O_SYMLINK: number;
O_DIRECT: number;
O_NONBLOCK: number;
S_IRWXU: number;
S_IRUSR: number;
S_IWUSR: number;
S_IXUSR: number;
S_IRWXG: number;
S_IRGRP: number;
S_IWGRP: number;
S_IXGRP: number;
S_IRWXO: number;
S_IROTH: number;
S_IWOTH: number;
S_IXOTH: number;
F_OK: number;
R_OK: number;
W_OK: number;
X_OK: number;
UV_FS_SYMLINK_DIR: number;
UV_FS_SYMLINK_JUNCTION: number;
UV_FS_COPYFILE_EXCL: number;
UV_FS_COPYFILE_FICLONE: number;
UV_FS_COPYFILE_FICLONE_FORCE: number;
COPYFILE_EXCL: number;
COPYFILE_FICLONE: number;
COPYFILE_FICLONE_FORCE: number;
};
export declare const enum S {
ISUID = 2048,// (04000) set-user-ID (set process effective user ID on execve(2))
ISGID = 1024,// (02000) set-group-ID (set process effective group ID on execve(2); mandatory locking, as described in fcntl(2); take a new file's group from parent directory, as described in chown(2) and mkdir(2))
ISVTX = 512,// (01000) sticky bit (restricted deletion flag, as described in unlink(2))
IRUSR = 256,// (00400) read by owner
IWUSR = 128,// (00200) write by owner
IXUSR = 64,// (00100) execute/search by owner
IRGRP = 32,// (00040) read by group
IWGRP = 16,// (00020) write by group
IXGRP = 8,// (00010) execute/search by group
IROTH = 4,// (00004) read by others
IWOTH = 2,// (00002) write by others
IXOTH = 1
}
export declare const enum MODE {
FILE = 438,
DIR = 511,
DEFAULT = 438
}
export declare const ERRSTR: {
PATH_STR: string;
FD: string;
MODE_INT: string;
CB: string;
UID: string;
GID: string;
LEN: string;
ATIME: string;
MTIME: string;
PREFIX: string;
BUFFER: string;
OFFSET: string;
LENGTH: string;
POSITION: string;
};
export declare enum FLAGS {
r,
'r+',
rs,
sr,
'rs+',
'sr+',
w,
wx,
xw,
'w+',
'wx+',
'xw+',
a,
ax,
xa,
'a+',
'ax+',
'xa+'
}
+106
View File
@@ -0,0 +1,106 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FLAGS = exports.ERRSTR = exports.constants = exports.SEP = void 0;
exports.SEP = '/';
exports.constants = {
O_RDONLY: 0,
O_WRONLY: 1,
O_RDWR: 2,
S_IFMT: 61440,
S_IFREG: 32768,
S_IFDIR: 16384,
S_IFCHR: 8192,
S_IFBLK: 24576,
S_IFIFO: 4096,
S_IFLNK: 40960,
S_IFSOCK: 49152,
O_CREAT: 64,
O_EXCL: 128,
O_NOCTTY: 256,
O_TRUNC: 512,
O_APPEND: 1024,
O_DIRECTORY: 65536,
O_NOATIME: 262144,
O_NOFOLLOW: 131072,
O_SYNC: 1052672,
O_SYMLINK: 2097152,
O_DIRECT: 16384,
O_NONBLOCK: 2048,
S_IRWXU: 448,
S_IRUSR: 256,
S_IWUSR: 128,
S_IXUSR: 64,
S_IRWXG: 56,
S_IRGRP: 32,
S_IWGRP: 16,
S_IXGRP: 8,
S_IRWXO: 7,
S_IROTH: 4,
S_IWOTH: 2,
S_IXOTH: 1,
F_OK: 0,
R_OK: 4,
W_OK: 2,
X_OK: 1,
UV_FS_SYMLINK_DIR: 1,
UV_FS_SYMLINK_JUNCTION: 2,
UV_FS_COPYFILE_EXCL: 1,
UV_FS_COPYFILE_FICLONE: 2,
UV_FS_COPYFILE_FICLONE_FORCE: 4,
COPYFILE_EXCL: 1,
COPYFILE_FICLONE: 2,
COPYFILE_FICLONE_FORCE: 4,
};
exports.ERRSTR = {
PATH_STR: 'path must be a string, Buffer, or Uint8Array',
// FD: 'file descriptor must be a unsigned 32-bit integer',
FD: 'fd must be a file descriptor',
MODE_INT: 'mode must be an int',
CB: 'callback must be a function',
UID: 'uid must be an unsigned int',
GID: 'gid must be an unsigned int',
LEN: 'len must be an integer',
ATIME: 'atime must be an integer',
MTIME: 'mtime must be an integer',
PREFIX: 'filename prefix is required',
BUFFER: 'buffer must be an instance of Buffer or StaticBuffer',
OFFSET: 'offset must be an integer',
LENGTH: 'length must be an integer',
POSITION: 'position must be an integer',
};
const { O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_EXCL, O_TRUNC, O_APPEND, O_SYNC } = exports.constants;
// List of file `flags` as defined by Node.
var FLAGS;
(function (FLAGS) {
// Open file for reading. An exception occurs if the file does not exist.
FLAGS[FLAGS["r"] = O_RDONLY] = "r";
// Open file for reading and writing. An exception occurs if the file does not exist.
FLAGS[FLAGS["r+"] = O_RDWR] = "r+";
// Open file for reading in synchronous mode. Instructs the operating system to bypass the local file system cache.
FLAGS[FLAGS["rs"] = O_RDONLY | O_SYNC] = "rs";
FLAGS[FLAGS["sr"] = FLAGS.rs] = "sr";
// Open file for reading and writing, telling the OS to open it synchronously. See notes for 'rs' about using this with caution.
FLAGS[FLAGS["rs+"] = O_RDWR | O_SYNC] = "rs+";
FLAGS[FLAGS["sr+"] = FLAGS['rs+']] = "sr+";
// Open file for writing. The file is created (if it does not exist) or truncated (if it exists).
FLAGS[FLAGS["w"] = O_WRONLY | O_CREAT | O_TRUNC] = "w";
// Like 'w' but fails if path exists.
FLAGS[FLAGS["wx"] = O_WRONLY | O_CREAT | O_TRUNC | O_EXCL] = "wx";
FLAGS[FLAGS["xw"] = FLAGS.wx] = "xw";
// Open file for reading and writing. The file is created (if it does not exist) or truncated (if it exists).
FLAGS[FLAGS["w+"] = O_RDWR | O_CREAT | O_TRUNC] = "w+";
// Like 'w+' but fails if path exists.
FLAGS[FLAGS["wx+"] = O_RDWR | O_CREAT | O_TRUNC | O_EXCL] = "wx+";
FLAGS[FLAGS["xw+"] = FLAGS['wx+']] = "xw+";
// Open file for appending. The file is created if it does not exist.
FLAGS[FLAGS["a"] = O_WRONLY | O_APPEND | O_CREAT] = "a";
// Like 'a' but fails if path exists.
FLAGS[FLAGS["ax"] = O_WRONLY | O_APPEND | O_CREAT | O_EXCL] = "ax";
FLAGS[FLAGS["xa"] = FLAGS.ax] = "xa";
// Open file for reading and appending. The file is created if it does not exist.
FLAGS[FLAGS["a+"] = O_RDWR | O_APPEND | O_CREAT] = "a+";
// Like 'a+' but fails if path exists.
FLAGS[FLAGS["ax+"] = O_RDWR | O_APPEND | O_CREAT | O_EXCL] = "ax+";
FLAGS[FLAGS["xa+"] = FLAGS['ax+']] = "xa+";
})(FLAGS || (exports.FLAGS = FLAGS = {}));
//# sourceMappingURL=constants.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG,GAAG,CAAC;AAMV,QAAA,SAAS,GAAG;IACvB,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,GAAG;IACZ,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE,OAAO;IACf,SAAS,EAAE,OAAO;IAClB,QAAQ,EAAE,KAAK;IACf,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IAEV,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IAEP,iBAAiB,EAAE,CAAC;IACpB,sBAAsB,EAAE,CAAC;IAEzB,mBAAmB,EAAE,CAAC;IACtB,sBAAsB,EAAE,CAAC;IACzB,4BAA4B,EAAE,CAAC;IAC/B,aAAa,EAAE,CAAC;IAChB,gBAAgB,EAAE,CAAC;IACnB,sBAAsB,EAAE,CAAC;CAC1B,CAAC;AAwBW,QAAA,MAAM,GAAG;IACpB,QAAQ,EAAE,8CAA8C;IACxD,uEAAuE;IACvE,EAAE,EAAE,8BAA8B;IAClC,QAAQ,EAAE,qBAAqB;IAC/B,EAAE,EAAE,6BAA6B;IACjC,GAAG,EAAE,6BAA6B;IAClC,GAAG,EAAE,6BAA6B;IAClC,GAAG,EAAE,wBAAwB;IAC7B,KAAK,EAAE,0BAA0B;IACjC,KAAK,EAAE,0BAA0B;IACjC,MAAM,EAAE,6BAA6B;IACrC,MAAM,EAAE,sDAAsD;IAC9D,MAAM,EAAE,2BAA2B;IACnC,MAAM,EAAE,2BAA2B;IACnC,QAAQ,EAAE,6BAA6B;CACxC,CAAC;AAEF,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,iBAAS,CAAC;AAE7F,2CAA2C;AAC3C,IAAY,KA+BX;AA/BD,WAAY,KAAK;IACf,yEAAyE;IACzE,mBAAI,QAAQ,OAAA,CAAA;IACZ,qFAAqF;IACrF,oBAAO,MAAM,QAAA,CAAA;IACb,mHAAmH;IACnH,oBAAK,QAAQ,GAAG,MAAM,QAAA,CAAA;IACtB,oBAAK,KAAK,CAAC,EAAE,QAAA,CAAA;IACb,gIAAgI;IAChI,qBAAQ,MAAM,GAAG,MAAM,SAAA,CAAA;IACvB,qBAAQ,KAAK,CAAC,KAAK,CAAC,SAAA,CAAA;IACpB,iGAAiG;IACjG,mBAAI,QAAQ,GAAG,OAAO,GAAG,OAAO,OAAA,CAAA;IAChC,qCAAqC;IACrC,oBAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,QAAA,CAAA;IAC1C,oBAAK,KAAK,CAAC,EAAE,QAAA,CAAA;IACb,6GAA6G;IAC7G,oBAAO,MAAM,GAAG,OAAO,GAAG,OAAO,QAAA,CAAA;IACjC,sCAAsC;IACtC,qBAAQ,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,SAAA,CAAA;IAC3C,qBAAQ,KAAK,CAAC,KAAK,CAAC,SAAA,CAAA;IACpB,qEAAqE;IACrE,mBAAI,QAAQ,GAAG,QAAQ,GAAG,OAAO,OAAA,CAAA;IACjC,qCAAqC;IACrC,oBAAK,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,QAAA,CAAA;IAC3C,oBAAK,KAAK,CAAC,EAAE,QAAA,CAAA;IACb,iFAAiF;IACjF,oBAAO,MAAM,GAAG,QAAQ,GAAG,OAAO,QAAA,CAAA;IAClC,sCAAsC;IACtC,qBAAQ,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,SAAA,CAAA;IAC5C,qBAAQ,KAAK,CAAC,KAAK,CAAC,SAAA,CAAA;AACtB,CAAC,EA/BW,KAAK,qBAAL,KAAK,QA+BhB"}
+9
View File
@@ -0,0 +1,9 @@
export declare const enum AMODE {
F_OK = 0,
/** Tests for Execute or Search permissions. */
X_OK = 1,
/** Tests for Write permission. */
W_OK = 2,
/** Tests for Read permission. */
R_OK = 4
}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=AMODE.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"AMODE.js","sourceRoot":"","sources":["../../src/consts/AMODE.ts"],"names":[],"mappings":""}
+53
View File
@@ -0,0 +1,53 @@
/**
* Constants used in `open` system calls, see [open(2)](http://man7.org/linux/man-pages/man2/open.2.html).
*
* These constants are compatible with Node.js fs constants and can be used with both
* memfs and native Node.js fs.promises.open().
*
* @see http://man7.org/linux/man-pages/man2/open.2.html
* @see https://www.gnu.org/software/libc/manual/html_node/Open_002dtime-Flags.html
*/
export declare enum FLAG {
O_RDONLY = 0,
O_WRONLY = 1,
O_RDWR = 2,
O_ACCMODE = 3,
O_CREAT = 64,
O_EXCL = 128,
O_NOCTTY = 256,
O_TRUNC = 512,
O_APPEND = 1024,
O_NONBLOCK = 2048,
O_DSYNC = 4096,
FASYNC = 8192,
O_DIRECT = 16384,
O_LARGEFILE = 0,
O_DIRECTORY = 65536,
O_NOFOLLOW = 131072,
O_NOATIME = 262144,
O_CLOEXEC = 524288,
O_SYNC = 1052672,
O_NDELAY = 2048
}
export declare const enum FLAG_CON {
O_RDONLY = 0,
O_WRONLY = 1,
O_RDWR = 2,
O_ACCMODE = 3,
O_CREAT = 64,
O_EXCL = 128,
O_NOCTTY = 256,
O_TRUNC = 512,
O_APPEND = 1024,
O_NONBLOCK = 2048,
O_DSYNC = 4096,
FASYNC = 8192,
O_DIRECT = 16384,
O_LARGEFILE = 0,
O_DIRECTORY = 65536,
O_NOFOLLOW = 131072,
O_NOATIME = 262144,
O_CLOEXEC = 524288,
O_SYNC = 1052672,
O_NDELAY = 2048
}
+36
View File
@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FLAG = void 0;
/**
* Constants used in `open` system calls, see [open(2)](http://man7.org/linux/man-pages/man2/open.2.html).
*
* These constants are compatible with Node.js fs constants and can be used with both
* memfs and native Node.js fs.promises.open().
*
* @see http://man7.org/linux/man-pages/man2/open.2.html
* @see https://www.gnu.org/software/libc/manual/html_node/Open_002dtime-Flags.html
*/
var FLAG;
(function (FLAG) {
FLAG[FLAG["O_RDONLY"] = 0] = "O_RDONLY";
FLAG[FLAG["O_WRONLY"] = 1] = "O_WRONLY";
FLAG[FLAG["O_RDWR"] = 2] = "O_RDWR";
FLAG[FLAG["O_ACCMODE"] = 3] = "O_ACCMODE";
FLAG[FLAG["O_CREAT"] = 64] = "O_CREAT";
FLAG[FLAG["O_EXCL"] = 128] = "O_EXCL";
FLAG[FLAG["O_NOCTTY"] = 256] = "O_NOCTTY";
FLAG[FLAG["O_TRUNC"] = 512] = "O_TRUNC";
FLAG[FLAG["O_APPEND"] = 1024] = "O_APPEND";
FLAG[FLAG["O_NONBLOCK"] = 2048] = "O_NONBLOCK";
FLAG[FLAG["O_DSYNC"] = 4096] = "O_DSYNC";
FLAG[FLAG["FASYNC"] = 8192] = "FASYNC";
FLAG[FLAG["O_DIRECT"] = 16384] = "O_DIRECT";
FLAG[FLAG["O_LARGEFILE"] = 0] = "O_LARGEFILE";
FLAG[FLAG["O_DIRECTORY"] = 65536] = "O_DIRECTORY";
FLAG[FLAG["O_NOFOLLOW"] = 131072] = "O_NOFOLLOW";
FLAG[FLAG["O_NOATIME"] = 262144] = "O_NOATIME";
FLAG[FLAG["O_CLOEXEC"] = 524288] = "O_CLOEXEC";
FLAG[FLAG["O_SYNC"] = 1052672] = "O_SYNC";
FLAG[FLAG["O_NDELAY"] = 2048] = "O_NDELAY";
})(FLAG || (exports.FLAG = FLAG = {}));
//# sourceMappingURL=FLAG.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"FLAG.js","sourceRoot":"","sources":["../../src/consts/FLAG.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,IAAY,IAqBX;AArBD,WAAY,IAAI;IACd,uCAAY,CAAA;IACZ,uCAAY,CAAA;IACZ,mCAAU,CAAA;IACV,yCAAa,CAAA;IACb,sCAAY,CAAA;IACZ,qCAAY,CAAA;IACZ,yCAAc,CAAA;IACd,uCAAa,CAAA;IACb,0CAAe,CAAA;IACf,8CAAiB,CAAA;IACjB,wCAAc,CAAA;IACd,sCAAa,CAAA;IACb,2CAAgB,CAAA;IAChB,6CAAe,CAAA;IACf,iDAAmB,CAAA;IACnB,gDAAmB,CAAA;IACnB,8CAAkB,CAAA;IAClB,8CAAkB,CAAA;IAClB,yCAAgB,CAAA;IAChB,0CAAe,CAAA;AACjB,CAAC,EArBW,IAAI,oBAAJ,IAAI,QAqBf"}
+4
View File
@@ -0,0 +1,4 @@
import { TDataOut, TEncodingExtended } from './types';
export declare const ENCODING_UTF8: BufferEncoding;
export declare function assertEncoding(encoding: string | undefined): void;
export declare function strToEncoding(str: string, encoding?: TEncodingExtended): TDataOut;
+20
View File
@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ENCODING_UTF8 = void 0;
exports.assertEncoding = assertEncoding;
exports.strToEncoding = strToEncoding;
const buffer_1 = require("@jsonjoy.com/fs-node-builtins/lib/internal/buffer");
const errors = require("@jsonjoy.com/fs-node-builtins/lib/internal/errors");
exports.ENCODING_UTF8 = 'utf8';
function assertEncoding(encoding) {
if (encoding && !buffer_1.Buffer.isEncoding(encoding))
throw new errors.TypeError('ERR_INVALID_OPT_VALUE_ENCODING', encoding);
}
function strToEncoding(str, encoding) {
if (!encoding || encoding === exports.ENCODING_UTF8)
return str; // UTF-8
if (encoding === 'buffer')
return new buffer_1.Buffer(str); // `buffer` encoding
return new buffer_1.Buffer(str).toString(encoding); // Custom encoding
}
//# sourceMappingURL=encoding.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":";;;AAMA,wCAEC;AAED,sCAIC;AAdD,8EAA2E;AAC3E,4EAA4E;AAG/D,QAAA,aAAa,GAAmB,MAAM,CAAC;AAEpD,SAAgB,cAAc,CAAC,QAA4B;IACzD,IAAI,QAAQ,IAAI,CAAC,eAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,gCAAgC,EAAE,QAAQ,CAAC,CAAC;AACvH,CAAC;AAED,SAAgB,aAAa,CAAC,GAAW,EAAE,QAA4B;IACrE,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,qBAAa;QAAE,OAAO,GAAG,CAAC,CAAC,QAAQ;IACjE,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,eAAM,CAAC,GAAG,CAAC,CAAC,CAAC,oBAAoB;IACvE,OAAO,IAAI,eAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,kBAAkB;AAC/D,CAAC"}
+6
View File
@@ -0,0 +1,6 @@
export * from './types';
export * from './constants';
export * from './consts/AMODE';
export * from './consts/FLAG';
export * from './path';
export * from './encoding';
+10
View File
@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./types"), exports);
tslib_1.__exportStar(require("./constants"), exports);
tslib_1.__exportStar(require("./consts/AMODE"), exports);
tslib_1.__exportStar(require("./consts/FLAG"), exports);
tslib_1.__exportStar(require("./path"), exports);
tslib_1.__exportStar(require("./encoding"), exports);
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,iDAAuB;AACvB,qDAA2B"}
@@ -0,0 +1,2 @@
import type { FsCallbackApi } from '../types';
export declare const fsCallbackApiList: Array<keyof FsCallbackApi>;
+55
View File
@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fsCallbackApiList = void 0;
exports.fsCallbackApiList = [
'access',
'appendFile',
'chmod',
'chown',
'close',
'copyFile',
'cp',
'createReadStream',
'createWriteStream',
'exists',
'fchmod',
'fchown',
'fdatasync',
'fstat',
'fsync',
'ftruncate',
'futimes',
'glob',
'lchmod',
'lchown',
'link',
'lstat',
'mkdir',
'mkdtemp',
'open',
'openAsBlob',
'opendir',
'read',
'readv',
'readdir',
'readFile',
'readlink',
'realpath',
'rename',
'rm',
'rmdir',
'stat',
'statfs',
'symlink',
'truncate',
'unlink',
'unwatchFile',
'utimes',
'lutimes',
'watch',
'watchFile',
'write',
'writev',
'writeFile',
];
//# sourceMappingURL=fsCallbackApiList.js.map
@@ -0,0 +1 @@
{"version":3,"file":"fsCallbackApiList.js","sourceRoot":"","sources":["../../src/lists/fsCallbackApiList.ts"],"names":[],"mappings":";;;AAEa,QAAA,iBAAiB,GAA+B;IAC3D,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,OAAO;IACP,OAAO;IACP,UAAU;IACV,IAAI;IACJ,kBAAkB;IAClB,mBAAmB;IACnB,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,OAAO;IACP,OAAO;IACP,WAAW;IACX,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,SAAS;IACT,MAAM;IACN,YAAY;IACZ,SAAS;IACT,MAAM;IACN,OAAO;IACP,SAAS;IACT,UAAU;IACV,UAAU;IACV,UAAU;IACV,QAAQ;IACR,IAAI;IACJ,OAAO;IACP,MAAM;IACN,QAAQ;IACR,SAAS;IACT,UAAU;IACV,QAAQ;IACR,aAAa;IACb,QAAQ;IACR,SAAS;IACT,OAAO;IACP,WAAW;IACX,OAAO;IACP,QAAQ;IACR,WAAW;CACZ,CAAC"}
@@ -0,0 +1,2 @@
import type { FsCommonObjects } from '../types/FsCommonObjects';
export declare const fsCommonObjectsList: Array<keyof FsCommonObjects>;
@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fsCommonObjectsList = void 0;
exports.fsCommonObjectsList = [
'F_OK',
'R_OK',
'W_OK',
'X_OK',
'constants',
'Stats',
'StatFs',
'Dir',
'Dirent',
'StatsWatcher',
'FSWatcher',
'ReadStream',
'WriteStream',
];
//# sourceMappingURL=fsCommonObjectsList.js.map
@@ -0,0 +1 @@
{"version":3,"file":"fsCommonObjectsList.js","sourceRoot":"","sources":["../../src/lists/fsCommonObjectsList.ts"],"names":[],"mappings":";;;AAEa,QAAA,mBAAmB,GAAiC;IAC/D,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,WAAW;IACX,OAAO;IACP,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,cAAc;IACd,WAAW;IACX,YAAY;IACZ,aAAa;CACd,CAAC"}
@@ -0,0 +1,2 @@
import type { FsSynchronousApi } from '../types';
export declare const fsSynchronousApiList: Array<keyof FsSynchronousApi>;
@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fsSynchronousApiList = void 0;
exports.fsSynchronousApiList = [
'accessSync',
'appendFileSync',
'chmodSync',
'chownSync',
'closeSync',
'copyFileSync',
'existsSync',
'fchmodSync',
'fchownSync',
'fdatasyncSync',
'fstatSync',
'fsyncSync',
'ftruncateSync',
'futimesSync',
'globSync',
'lchmodSync',
'lchownSync',
'linkSync',
'lstatSync',
'mkdirSync',
'mkdtempSync',
'openSync',
'opendirSync',
'readdirSync',
'readFileSync',
'readlinkSync',
'readSync',
'readvSync',
'realpathSync',
'renameSync',
'rmdirSync',
'rmSync',
'statSync',
'symlinkSync',
'truncateSync',
'unlinkSync',
'utimesSync',
'lutimesSync',
'writeFileSync',
'writeSync',
'writevSync',
// 'cpSync',
// 'statfsSync',
];
//# sourceMappingURL=fsSynchronousApiList.js.map
@@ -0,0 +1 @@
{"version":3,"file":"fsSynchronousApiList.js","sourceRoot":"","sources":["../../src/lists/fsSynchronousApiList.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAkC;IACjE,YAAY;IACZ,gBAAgB;IAChB,WAAW;IACX,WAAW;IACX,WAAW;IACX,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,WAAW;IACX,WAAW;IACX,eAAe;IACf,aAAa;IACb,UAAU;IACV,YAAY;IACZ,YAAY;IACZ,UAAU;IACV,WAAW;IACX,WAAW;IACX,aAAa;IACb,UAAU;IACV,aAAa;IACb,aAAa;IACb,cAAc;IACd,cAAc;IACd,UAAU;IACV,WAAW;IACX,cAAc;IACd,YAAY;IACZ,WAAW;IACX,QAAQ;IACR,UAAU;IACV,aAAa;IACb,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,aAAa;IACb,eAAe;IACf,WAAW;IACX,YAAY;IAEZ,YAAY;IACZ,gBAAgB;CACjB,CAAC"}
+1
View File
@@ -0,0 +1 @@
export declare const basename: (path: string, separator: string) => string;
+11
View File
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.basename = void 0;
const basename = (path, separator) => {
if (path[path.length - 1] === separator)
path = path.slice(0, -1);
const lastSlashIndex = path.lastIndexOf(separator);
return lastSlashIndex === -1 ? path : path.slice(lastSlashIndex + 1);
};
exports.basename = basename;
//# sourceMappingURL=path.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"path.js","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":";;;AAAO,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,SAAiB,EAAE,EAAE;IAC1D,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,SAAS;QAAE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACnD,OAAO,cAAc,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;AACvE,CAAC,CAAC;AAJW,QAAA,QAAQ,YAInB"}
+7
View File
@@ -0,0 +1,7 @@
export type TSetTimeout = (callback: (...args: any[]) => void, time?: number, args?: any[]) => any;
/**
* `setTimeoutUnref` is just like `setTimeout`,
* only in Node's environment it will "unref" its macro task.
*/
declare function setTimeoutUnref(callback: any, time?: any, args?: any): object;
export default setTimeoutUnref;
+14
View File
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* `setTimeoutUnref` is just like `setTimeout`,
* only in Node's environment it will "unref" its macro task.
*/
function setTimeoutUnref(callback, time, args) {
const ref = setTimeout.apply(typeof globalThis !== 'undefined' ? globalThis : global, arguments);
if (ref && typeof ref === 'object' && typeof ref.unref === 'function')
ref.unref();
return ref;
}
exports.default = setTimeoutUnref;
//# sourceMappingURL=setTimeoutUnref.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"setTimeoutUnref.js","sourceRoot":"","sources":["../src/setTimeoutUnref.ts"],"names":[],"mappings":";;AAEA;;;GAGG;AACH,SAAS,eAAe,CAAC,QAAQ,EAAE,IAAK,EAAE,IAAK;IAC7C,MAAM,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACjG,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,UAAU;QAAE,GAAG,CAAC,KAAK,EAAE,CAAC;IACnF,OAAO,GAAG,CAAC;AACb,CAAC;AAED,kBAAe,eAAe,CAAC"}
+143
View File
@@ -0,0 +1,143 @@
import type * as misc from './misc';
import type * as opts from './options';
export interface FsCallbackApi {
access: {
(path: misc.PathLike, callback: misc.TCallback<void>): void;
(path: misc.PathLike, mode: number, callback: misc.TCallback<void>): void;
};
appendFile: {
(id: misc.TFileId, data: misc.TData, callback: misc.TCallback<void>): void;
(id: misc.TFileId, data: misc.TData, options: opts.IAppendFileOptions | string, callback: misc.TCallback<void>): void;
};
chmod: (path: misc.PathLike, mode: misc.TMode, callback: misc.TCallback<void>) => void;
chown: (path: misc.PathLike, uid: number, gid: number, callback: misc.TCallback<void>) => void;
close: (fd: number, callback: misc.TCallback<void>) => void;
copyFile: {
(src: misc.PathLike, dest: misc.PathLike, callback: misc.TCallback<void>): void;
(src: misc.PathLike, dest: misc.PathLike, flags: misc.TFlagsCopy, callback: misc.TCallback<void>): void;
};
cp: {
(src: string | URL, dest: string | URL, callback: misc.TCallback<void>): void;
(src: string | URL, dest: string | URL, options: opts.ICpOptions, callback: misc.TCallback<void>): void;
};
createReadStream: (path: misc.PathLike, options?: opts.IReadStreamOptions | string) => misc.IReadStream;
createWriteStream: (path: misc.PathLike, options?: opts.IWriteStreamOptions | string) => misc.IWriteStream;
exists: (path: misc.PathLike, callback: (exists: boolean) => void) => void;
fchmod: (fd: number, mode: misc.TMode, callback: misc.TCallback<void>) => void;
fchown: (fd: number, uid: number, gid: number, callback: misc.TCallback<void>) => void;
fdatasync: (fd: number, callback: misc.TCallback<void>) => void;
fsync: (fd: number, callback: misc.TCallback<void>) => void;
fstat: {
(fd: number, callback: misc.TCallback<misc.IStats>): void;
(fd: number, options: opts.IFStatOptions, callback: misc.TCallback<misc.IStats>): void;
};
ftruncate: {
(fd: number, callback: misc.TCallback<void>): void;
(fd: number, len: number, callback: misc.TCallback<void>): void;
};
futimes: (fd: number, atime: misc.TTime, mtime: misc.TTime, callback: misc.TCallback<void>) => void;
glob: {
(pattern: string, callback: misc.TCallback<string[]>): void;
(pattern: string, options: opts.IGlobOptions, callback: misc.TCallback<string[]>): void;
};
lchmod: (path: misc.PathLike, mode: misc.TMode, callback: misc.TCallback<void>) => void;
lchown: (path: misc.PathLike, uid: number, gid: number, callback: misc.TCallback<void>) => void;
lutimes: (path: misc.PathLike, atime: number | string | Date, mtime: number | string | Date, callback: misc.TCallback<void>) => void;
link: (existingPath: misc.PathLike, newPath: misc.PathLike, callback: misc.TCallback<void>) => void;
lstat: {
(path: misc.PathLike, callback: misc.TCallback<misc.IStats>): void;
(path: misc.PathLike, options: opts.IStatOptions, callback: misc.TCallback<misc.IStats>): void;
};
mkdir: {
(path: misc.PathLike, callback: misc.TCallback<void>): void;
(path: misc.PathLike, mode: misc.TMode | (opts.IMkdirOptions & {
recursive?: false;
}), callback: misc.TCallback<void>): void;
(path: misc.PathLike, mode: opts.IMkdirOptions & {
recursive: true;
}, callback: misc.TCallback<string>): void;
(path: misc.PathLike, mode: misc.TMode | opts.IMkdirOptions, callback: misc.TCallback<string>): void;
};
mkdtemp: {
(prefix: string, callback: misc.TCallback<string>): void;
(prefix: string, options: opts.IOptions, callback: misc.TCallback<string>): void;
};
open: {
(path: misc.PathLike, flags: misc.TFlags, callback: misc.TCallback<number>): void;
(path: misc.PathLike, flags: misc.TFlags, mode: misc.TMode, callback: misc.TCallback<number>): void;
};
openAsBlob: (path: misc.PathLike, options?: opts.IOpenAsBlobOptions) => Promise<Blob>;
opendir: (path: misc.PathLike, options: opts.IOpendirOptions, callback: misc.TCallback<misc.IDir>) => void;
read: (fd: number, buffer: Buffer | ArrayBufferView | DataView, offset: number, length: number, position: number, callback: (err?: Error | null, bytesRead?: number, buffer?: Buffer | ArrayBufferView | DataView) => void) => void;
readdir: {
(path: misc.PathLike, callback: misc.TCallback<misc.TDataOut[] | misc.IDirent[]>): void;
(path: misc.PathLike, options: opts.IReaddirOptions | string, callback: misc.TCallback<misc.TDataOut[] | misc.IDirent[]>): void;
};
readFile: {
(id: misc.TFileId, callback: misc.TCallback<misc.TDataOut>): void;
(id: misc.TFileId, options: opts.IReadFileOptions | string, callback: misc.TCallback<misc.TDataOut>): void;
};
readlink: {
(path: misc.PathLike, callback: misc.TCallback<misc.TDataOut>): void;
(path: misc.PathLike, options: opts.IOptions, callback: misc.TCallback<misc.TDataOut>): void;
};
readv: {
(fd: number, buffers: ArrayBufferView[], callback: misc.TCallback2<number, ArrayBufferView[]>): void;
(fd: number, buffers: ArrayBufferView[], position: number | null, callback: misc.TCallback2<number, ArrayBufferView[]>): void;
};
realpath: {
(path: misc.PathLike, callback: misc.TCallback<misc.TDataOut>): void;
(path: misc.PathLike, options: opts.IRealpathOptions | string, callback: misc.TCallback<misc.TDataOut>): void;
};
rename: (oldPath: misc.PathLike, newPath: misc.PathLike, callback: misc.TCallback<void>) => void;
rmdir: {
(path: misc.PathLike, callback: misc.TCallback<void>): void;
(path: misc.PathLike, options: opts.IRmdirOptions, callback: misc.TCallback<void>): void;
};
rm: {
(path: misc.PathLike, callback: misc.TCallback<void>): void;
(path: misc.PathLike, options: opts.IRmOptions, callback: misc.TCallback<void>): void;
};
stat: {
(path: misc.PathLike, callback: misc.TCallback<misc.IStats>): void;
(path: misc.PathLike, options: opts.IStatOptions, callback: misc.TCallback<misc.IStats>): void;
};
statfs: {
(path: misc.PathLike, callback: misc.TCallback<misc.IStatFs>): void;
(path: misc.PathLike, options: opts.IStatOptions, callback: misc.TCallback<misc.IStatFs>): void;
};
symlink: {
(target: misc.PathLike, path: misc.PathLike, callback: misc.TCallback<void>): void;
(target: misc.PathLike, path: misc.PathLike, type: misc.symlink.Type, callback: misc.TCallback<void>): void;
};
truncate: {
(id: misc.PathLike, callback: misc.TCallback<void>): void;
(id: misc.PathLike, len: number, callback: misc.TCallback<void>): void;
};
unlink: (path: misc.PathLike, callback: misc.TCallback<void>) => void;
unwatchFile: (path: misc.PathLike, listener?: (curr: misc.IStats, prev: misc.IStats) => void) => void;
utimes: (path: misc.PathLike, atime: misc.TTime, mtime: misc.TTime, callback: misc.TCallback<void>) => void;
watch: (path: misc.PathLike, options?: opts.IWatchOptions | string, listener?: (eventType: string, filename: string) => void) => misc.IFSWatcher;
watchFile: {
(path: misc.PathLike, listener: (curr: misc.IStats, prev: misc.IStats) => void): misc.IStatWatcher;
(path: misc.PathLike, options: opts.IWatchFileOptions, listener: (curr: misc.IStats, prev: misc.IStats) => void): misc.IStatWatcher;
};
write: {
(fd: number, buffer: Buffer | ArrayBufferView | DataView, callback: (...args: any[]) => void): void;
(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset: number, callback: (...args: any[]) => void): void;
(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset: number, length: number, callback: (...args: any[]) => void): void;
(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset: number, length: number, position: number, callback: (...args: any[]) => void): void;
(fd: number, str: string, callback: (...args: any[]) => void): void;
(fd: number, str: string, position: number, callback: (...args: any[]) => void): void;
(fd: number, str: string, position: number, encoding: BufferEncoding, callback: (...args: any[]) => void): void;
};
writeFile: {
(id: misc.TFileId, data: misc.TData, callback: misc.TCallback<void>): void;
(id: misc.TFileId, data: misc.TData, options: opts.IWriteFileOptions | string, callback: misc.TCallback<void>): void;
};
writev: {
(fd: number, buffers: ArrayBufferView[], callback: WritevCallback): void;
(fd: number, buffers: ArrayBufferView[], position: number | null, callback: WritevCallback): void;
};
}
export type WritevCallback = (err: Error | null, bytesWritten?: number, buffers?: ArrayBufferView[]) => void;
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=FsCallbackApi.js.map
@@ -0,0 +1 @@
{"version":3,"file":"FsCallbackApi.js","sourceRoot":"","sources":["../../src/types/FsCallbackApi.ts"],"names":[],"mappings":""}
+17
View File
@@ -0,0 +1,17 @@
import type { constants } from '../constants';
import type * as misc from './misc';
export interface FsCommonObjects {
F_OK: number;
R_OK: number;
W_OK: number;
X_OK: number;
constants: typeof constants;
Dir: new (...args: unknown[]) => misc.IDir;
Dirent: new (...args: unknown[]) => misc.IDirent;
FSWatcher: new (...args: unknown[]) => misc.IFSWatcher;
ReadStream: new (...args: unknown[]) => misc.IReadStream;
StatFs: new (...args: unknown[]) => misc.IStatFs;
Stats: new (...args: unknown[]) => misc.IStats;
StatsWatcher: new (...args: unknown[]) => misc.IStatWatcher;
WriteStream: new (...args: unknown[]) => misc.IWriteStream;
}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=FsCommonObjects.js.map
@@ -0,0 +1 @@
{"version":3,"file":"FsCommonObjects.js","sourceRoot":"","sources":["../../src/types/FsCommonObjects.ts"],"names":[],"mappings":""}
+41
View File
@@ -0,0 +1,41 @@
import type { constants } from '../constants';
import * as misc from './misc';
import * as opts from './options';
export interface FsPromisesApi {
constants: typeof constants;
FileHandle: new (...args: unknown[]) => misc.IFileHandle;
access: (path: misc.PathLike, mode?: number) => Promise<void>;
appendFile: (path: misc.TFileHandle, data: misc.TData, options?: opts.IAppendFileOptions | string) => Promise<void>;
chmod: (path: misc.PathLike, mode: misc.TMode) => Promise<void>;
chown: (path: misc.PathLike, uid: number, gid: number) => Promise<void>;
copyFile: (src: misc.PathLike, dest: misc.PathLike, flags?: misc.TFlagsCopy) => Promise<void>;
cp: (src: string | URL, dest: string | URL, options?: opts.ICpOptions) => Promise<void>;
lchmod: (path: misc.PathLike, mode: misc.TMode) => Promise<void>;
lchown: (path: misc.PathLike, uid: number, gid: number) => Promise<void>;
lutimes: (path: misc.PathLike, atime: misc.TTime, mtime: misc.TTime) => Promise<void>;
link: (existingPath: misc.PathLike, newPath: misc.PathLike) => Promise<void>;
lstat: (path: misc.PathLike, options?: opts.IStatOptions) => Promise<misc.IStats>;
mkdir: (path: misc.PathLike, options?: misc.TMode | opts.IMkdirOptions) => Promise<string | undefined>;
mkdtemp: (prefix: string, options?: opts.IOptions) => Promise<misc.TDataOut>;
open: (path: misc.PathLike, flags?: misc.TFlags, mode?: misc.TMode) => Promise<misc.IFileHandle>;
opendir: (path: misc.PathLike, options?: opts.IOpendirOptions) => Promise<misc.IDir>;
readdir: (path: misc.PathLike, options?: opts.IReaddirOptions | string) => Promise<misc.TDataOut[] | misc.IDirent[]>;
readFile: (id: misc.TFileHandle, options?: opts.IReadFileOptions | string) => Promise<misc.TDataOut>;
readlink: (path: misc.PathLike, options?: opts.IOptions) => Promise<misc.TDataOut>;
realpath: (path: misc.PathLike, options?: opts.IRealpathOptions | string) => Promise<misc.TDataOut>;
rename: (oldPath: misc.PathLike, newPath: misc.PathLike) => Promise<void>;
rmdir: (path: misc.PathLike, options?: opts.IRmdirOptions) => Promise<void>;
rm: (path: misc.PathLike, options?: opts.IRmOptions) => Promise<void>;
stat: (path: misc.PathLike, options?: opts.IStatOptions) => Promise<misc.IStats>;
statfs: (path: misc.PathLike, options?: opts.IStatOptions) => Promise<misc.IStatFs>;
symlink: (target: misc.PathLike, path: misc.PathLike, type?: misc.symlink.Type) => Promise<void>;
truncate: (path: misc.PathLike, len?: number) => Promise<void>;
unlink: (path: misc.PathLike) => Promise<void>;
utimes: (path: misc.PathLike, atime: misc.TTime, mtime: misc.TTime) => Promise<void>;
watch: (filename: misc.PathLike, options?: opts.IWatchOptions) => AsyncIterableIterator<{
eventType: string;
filename: string | Buffer;
}>;
writeFile: (id: misc.TFileHandle, data: misc.TPromisesData, options?: opts.IWriteFileOptions) => Promise<void>;
glob: (pattern: string, options?: opts.IGlobOptions) => Promise<string[]>;
}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=FsPromisesApi.js.map
@@ -0,0 +1 @@
{"version":3,"file":"FsPromisesApi.js","sourceRoot":"","sources":["../../src/types/FsPromisesApi.ts"],"names":[],"mappings":""}
+114
View File
@@ -0,0 +1,114 @@
import type * as misc from './misc';
import type * as opts from './options';
export interface FsSynchronousApi {
accessSync: (path: misc.PathLike, mode?: number) => void;
appendFileSync: (id: misc.TFileId, data: misc.TData, options?: opts.IAppendFileOptions | string) => void;
chmodSync: (path: misc.PathLike, mode: misc.TMode) => void;
chownSync: (path: misc.PathLike, uid: number, gid: number) => void;
closeSync: (fd: number) => void;
copyFileSync: (src: misc.PathLike, dest: misc.PathLike, flags?: misc.TFlagsCopy) => void;
cpSync: (src: string | URL, dest: string | URL, options?: opts.ICpOptions) => void;
existsSync: (path: misc.PathLike) => boolean;
fchmodSync: (fd: number, mode: misc.TMode) => void;
fchownSync: (fd: number, uid: number, gid: number) => void;
fdatasyncSync: (fd: number) => void;
fstatSync: {
(fd: number, options: {
bigint: false;
}): misc.IStats<number>;
(fd: number, options: {
bigint: true;
}): misc.IStats<bigint>;
(fd: number): misc.IStats<number>;
};
fsyncSync: (fd: number) => void;
ftruncateSync: (fd: number, len?: number) => void;
futimesSync: (fd: number, atime: misc.TTime, mtime: misc.TTime) => void;
globSync: (pattern: string, options?: opts.IGlobOptions) => string[];
lchmodSync: (path: misc.PathLike, mode: misc.TMode) => void;
lchownSync: (path: misc.PathLike, uid: number, gid: number) => void;
lutimesSync: (path: misc.PathLike, atime: number | string | Date, time: number | string | Date) => void;
linkSync: (existingPath: misc.PathLike, newPath: misc.PathLike) => void;
lstatSync: {
(path: misc.PathLike, options: {
bigint: false;
throwIfNoEntry: false;
}): misc.IStats<number> | undefined;
(path: misc.PathLike, options: {
bigint: false;
throwIfNoEntry?: true | undefined;
}): misc.IStats<number>;
(path: misc.PathLike, options: {
bigint: true;
throwIfNoEntry: false;
}): misc.IStats<bigint> | undefined;
(path: misc.PathLike, options: {
bigint: true;
throwIfNoEntry?: true | undefined;
}): misc.IStats<bigint>;
(path: misc.PathLike, options: {
throwIfNoEntry: false;
}): misc.IStats<number> | undefined;
(path: misc.PathLike, options: {
throwIfNoEntry?: true | undefined;
}): misc.IStats<number>;
(path: misc.PathLike): misc.IStats<number>;
};
mkdirSync: {
(path: misc.PathLike, options: opts.IMkdirOptions & {
recursive: true;
}): string | undefined;
(path: misc.PathLike, options?: misc.TMode | (opts.IMkdirOptions & {
recursive?: false;
})): void;
(path: misc.PathLike, options?: misc.TMode | opts.IMkdirOptions): string | undefined;
};
mkdtempSync: (prefix: string, options?: opts.IOptions) => misc.TDataOut;
openSync: (path: misc.PathLike, flags: misc.TFlags, mode?: misc.TMode) => number;
opendirSync: (path: misc.PathLike, options?: opts.IOpendirOptions) => misc.IDir;
readdirSync: (path: misc.PathLike, options?: opts.IReaddirOptions | string) => misc.TDataOut[] | misc.IDirent[];
readlinkSync: (path: misc.PathLike, options?: opts.IOptions) => misc.TDataOut;
readSync: (fd: number, buffer: Buffer | ArrayBufferView | DataView, offset: number, length: number, position: number) => number;
readFileSync: (file: misc.TFileId, options?: opts.IReadFileOptions | string) => misc.TDataOut;
readvSync: (fd: number, buffers: ArrayBufferView[], position?: number | null) => number;
realpathSync: (path: misc.PathLike, options?: opts.IRealpathOptions | string) => misc.TDataOut;
renameSync: (oldPath: misc.PathLike, newPath: misc.PathLike) => void;
rmdirSync: (path: misc.PathLike, options?: opts.IRmdirOptions) => void;
rmSync: (path: misc.PathLike, options?: opts.IRmOptions) => void;
statSync: {
(path: misc.PathLike, options: {
bigint: false;
throwIfNoEntry: false;
}): misc.IStats<number> | undefined;
(path: misc.PathLike, options: {
bigint: false;
throwIfNoEntry?: true;
}): misc.IStats<number>;
(path: misc.PathLike, options: {
bigint: true;
throwIfNoEntry: false;
}): misc.IStats<bigint> | undefined;
(path: misc.PathLike, options: {
bigint: true;
throwIfNoEntry?: true;
}): misc.IStats<bigint>;
(path: misc.PathLike, options: {
throwIfNoEntry: false;
}): misc.IStats<number> | undefined;
(path: misc.PathLike, options: {
throwIfNoEntry?: true;
}): misc.IStats<number>;
(path: misc.PathLike): misc.IStats<number>;
};
statfsSync: (path: misc.PathLike, options?: opts.IStafsOptions) => misc.IStatFs;
symlinkSync: (target: misc.PathLike, path: misc.PathLike, type?: misc.symlink.Type) => void;
truncateSync: (id: misc.TFileId, len?: number) => void;
unlinkSync: (path: misc.PathLike) => void;
utimesSync: (path: misc.PathLike, atime: misc.TTime, mtime: misc.TTime) => void;
writeFileSync: (id: misc.TFileId, data: misc.TData, options?: opts.IWriteFileOptions) => void;
writeSync: {
(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset?: number, length?: number, position?: number | null): number;
(fd: number, str: string, position?: number, encoding?: BufferEncoding): number;
};
writevSync: (fd: number, buffers: ArrayBufferView[], position?: number | null) => number;
}
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=FsSynchronousApi.js.map
@@ -0,0 +1 @@
{"version":3,"file":"FsSynchronousApi.js","sourceRoot":"","sources":["../../src/types/FsSynchronousApi.ts"],"names":[],"mappings":""}
+8
View File
@@ -0,0 +1,8 @@
import type { FsSynchronousApi } from './FsSynchronousApi';
import type { FsCallbackApi } from './FsCallbackApi';
import type { FsPromisesApi } from './FsPromisesApi';
export type * from './misc';
export { FsSynchronousApi, FsCallbackApi, FsPromisesApi };
export interface FsApi extends FsCallbackApi, FsSynchronousApi {
promises: FsPromisesApi;
}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
+157
View File
@@ -0,0 +1,157 @@
import type { PathLike as NodePathLike, symlink } from '@jsonjoy.com/fs-node-builtins/lib/fs';
import type { constants } from '../constants';
import type { EventEmitter } from '@jsonjoy.com/fs-node-builtins/lib/events';
import type { TSetTimeout } from '../setTimeoutUnref';
import type { IAppendFileOptions, IFileHandleReadStreamOptions, IFileHandleWriteStreamOptions, IReadableWebStreamOptions, IReadFileOptions, IStatOptions, IWriteFileOptions } from './options';
import type { Readable, Writable } from '@jsonjoy.com/fs-node-builtins/lib/stream';
export { symlink };
export type PathLike = NodePathLike | Uint8Array;
export type TDataOut = string | Buffer;
export type TEncodingExtended = BufferEncoding | 'buffer';
export type TFileId = PathLike | number;
export type TData = TDataOut | ArrayBufferView | DataView;
export type TPromisesData = TData | Readable;
export type TFlags = string | number;
export type TMode = string | number;
export type TTime = number | string | Date;
export type TCallback<TData> = (error?: IError | null, data?: TData) => void;
export type TCallback2<T1, T2> = (error: IError | null, bytesRead?: T1, buffers?: T2) => void;
export interface IError extends Error {
code?: string;
}
export type TFlagsCopy = typeof constants.COPYFILE_EXCL | typeof constants.COPYFILE_FICLONE | typeof constants.COPYFILE_FICLONE_FORCE;
export type TStatNumber = number | bigint;
export interface IStats<T = TStatNumber> {
uid: T;
gid: T;
rdev: T;
blksize: T;
ino: T;
size: T;
blocks: T;
atime: Date;
mtime: Date;
ctime: Date;
birthtime: Date;
atimeMs: T;
mtimeMs: T;
ctimeMs: T;
birthtimeMs: T;
dev: T;
mode: T;
nlink: T;
isDirectory(): boolean;
isFile(): boolean;
isBlockDevice(): boolean;
isCharacterDevice(): boolean;
isSymbolicLink(): boolean;
isFIFO(): boolean;
isSocket(): boolean;
}
export interface IStatFs<T = TStatNumber> {
bavail: T;
bfree: T;
blocks: T;
bsize: T;
ffree: T;
files: T;
type: T;
}
export interface IDir extends Disposable, AsyncDisposable {
path: string;
close(): Promise<void>;
close(callback?: (err?: Error) => void): void;
closeSync(): void;
read(): Promise<IDirent | null>;
read(callback?: (err: Error | null, dir?: IDirent | null) => void): void;
readSync(): IDirent | null;
[Symbol.asyncIterator](): AsyncIterableIterator<IDirent>;
}
export interface IDirent {
name: TDataOut;
/**
* @deprecated
* @see https://nodejs.org/api/deprecations.html#DEP0178
*/
parent?: string;
parentPath: string;
isDirectory(): boolean;
isFile(): boolean;
isBlockDevice(): boolean;
isCharacterDevice(): boolean;
isSymbolicLink(): boolean;
isFIFO(): boolean;
isSocket(): boolean;
}
export interface IStatWatcher extends EventEmitter {
filename: string;
interval: number;
timeoutRef?: any;
setTimeout: TSetTimeout;
prev: IStats;
start(path: string, persistent?: boolean, interval?: number): void;
stop(): void;
}
export interface IReadStream extends Readable {
bytesRead: number;
path: string | Buffer;
pending: boolean;
}
export interface IWriteStream extends Writable {
bytesWritten: number;
path: string;
pending: boolean;
close(callback?: (err?: Error) => void): void;
}
export interface IFSWatcher extends EventEmitter {
start(path: PathLike, persistent?: boolean, recursive?: boolean, encoding?: BufferEncoding): void;
close(): void;
}
/**
* Declare ReadableStream in case dom.d.ts is not added to the tsconfig lib causing
* ReadableStream interface is not defined. For developers with dom.d.ts added,
* the ReadableStream interface will be merged correctly.
*/
declare global {
export interface ReadableStream {
}
}
export interface IFileHandle extends EventEmitter {
fd: number;
getAsyncId(): number;
appendFile(data: TData, options?: IAppendFileOptions | string): Promise<void>;
chmod(mode: TMode): Promise<void>;
chown(uid: number, gid: number): Promise<void>;
close(): Promise<void>;
createReadStream(options?: IFileHandleReadStreamOptions): IReadStream;
createWriteStream(options?: IFileHandleWriteStreamOptions): IWriteStream;
datasync(): Promise<void>;
readableWebStream(options?: IReadableWebStreamOptions): ReadableStream;
read(buffer: Buffer | Uint8Array, offset: number, length: number, position?: number | null): Promise<TFileHandleReadResult>;
readv(buffers: ArrayBufferView[], position?: number | null): Promise<TFileHandleReadvResult>;
readFile(options?: IReadFileOptions | string): Promise<TDataOut>;
stat(options?: IStatOptions): Promise<IStats>;
truncate(len?: number): Promise<void>;
utimes(atime: TTime, mtime: TTime): Promise<void>;
write(buffer: Buffer | ArrayBufferView | DataView, offset?: number, length?: number, position?: number | null): Promise<TFileHandleWriteResult>;
writev(buffers: ArrayBufferView[], position?: number | null): Promise<TFileHandleWritevResult>;
writeFile(data: TData, options?: IWriteFileOptions): Promise<void>;
}
export type TFileHandle = PathLike | IFileHandle;
export interface TFileHandleReadResult {
bytesRead: number;
buffer: Buffer | Uint8Array;
}
export interface TFileHandleWriteResult {
bytesWritten: number;
buffer: Buffer | Uint8Array;
}
export interface TFileHandleReadvResult {
bytesRead: number;
buffers: ArrayBufferView[];
}
export interface TFileHandleWritevResult {
bytesWritten: number;
buffers: ArrayBufferView[];
}
export type AssertCallback<T> = T extends () => void ? T : never;
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=misc.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"misc.js","sourceRoot":"","sources":["../../src/types/misc.ts"],"names":[],"mappings":""}
+191
View File
@@ -0,0 +1,191 @@
import type { IFileHandle, TEncodingExtended, TFlags, TMode } from './misc';
export interface IOptions {
encoding?: BufferEncoding | TEncodingExtended;
}
export interface IFileOptions extends IOptions {
mode?: TMode;
flag?: TFlags;
}
export interface IWriteFileOptions extends IFileOptions {
}
export interface IReadFileOptions extends IOptions {
flag?: string;
}
export interface IRealpathOptions {
encoding?: TEncodingExtended;
}
export interface IAppendFileOptions extends IFileOptions {
}
export interface IStatOptions {
bigint?: boolean;
throwIfNoEntry?: boolean;
}
export interface IFStatOptions {
bigint?: boolean;
}
export interface IAppendFileOptions extends IFileOptions {
}
export interface IReadableWebStreamOptions {
type?: 'bytes' | undefined;
autoClose?: boolean;
}
export interface IFileHandleReadStreamOptions {
encoding?: BufferEncoding;
autoClose?: boolean;
emitClose?: boolean;
start?: number | undefined;
end?: number;
highWaterMark?: number;
flush?: boolean;
signal?: AbortSignal | undefined;
}
export interface IFileHandleWriteStreamOptions {
encoding?: BufferEncoding;
autoClose?: boolean;
emitClose?: boolean;
start?: number;
highWaterMark?: number;
flush?: boolean;
}
export interface IReaddirOptions extends IOptions {
recursive?: boolean;
withFileTypes?: boolean;
}
export interface IMkdirOptions {
mode?: TMode;
recursive?: boolean;
}
export interface IRmdirOptions {
recursive?: boolean;
maxRetries?: number;
retryDelay?: number;
}
export interface IRmOptions {
force?: boolean;
maxRetries?: number;
recursive?: boolean;
retryDelay?: number;
}
export interface IWatchFileOptions {
persistent?: boolean;
interval?: number;
}
export interface IReadStreamOptions extends IOptions {
/** Defaults to `'r'`. */
flags?: TFlags;
/** Defaults to `null`. */
encoding?: BufferEncoding;
/** Defaults to `null`. */
fd?: number | IFileHandle | null;
/** Defaults to 0o666 */
mode?: TMode;
/** Defaults to `true`. */
autoClose?: boolean;
/** Defaults to `true`. */
emitClose?: boolean;
start?: number;
/** Defaults to `Infinity`. */
end?: number;
/** Defaults to `64 * 1024`. */
highWaterMark?: number;
/** Defaults to `null`. */
fs?: object | null;
/** Defaults to `null`. */
signal?: AbortSignal | null;
}
export interface IWriteStreamOptions {
flags?: TFlags;
encoding?: BufferEncoding;
fd?: number | IFileHandle;
mode?: TMode;
autoClose?: boolean;
emitClose?: boolean;
start?: number;
}
export interface IWatchOptions extends IOptions {
/**
* Indicates whether the process should continue to run as long as files are
* being watched. Default: true.
*/
persistent?: boolean;
/**
* Indicates whether all subdirectories should be watched, or only the current
* directory. This applies when a directory is specified, and only on
* supported platforms (See caveats). Default: false.
*/
recursive?: boolean;
/**
* Allows closing the watcher with an {@link AbortSignal}.
*/
signal?: AbortSignal;
/**
* Specifies the number of events to queue between iterations of the AsyncIterator.
* Default: 2048.
*/
maxQueue?: number;
/**
* Either 'ignore' or 'throw' when there are more events to be queued than maxQueue allows.
* 'ignore' means overflow events are dropped and a warning is emitted, while 'throw'
* means to throw an exception. Default: 'ignore'.
*/
overflow?: 'ignore' | 'throw';
}
export interface ICpOptions {
/** dereference symlinks. Default: false. */
dereference?: boolean;
/**
* When force is false, and the destination exists, throw an error.
* Default: false.
*/
errorOnExist?: boolean;
/**
* Function to filter copied files/directories. Return true to copy the item,
* false to ignore it. Default: undefined.
*/
filter?: (src: string, dest: string) => boolean;
/**
* Overwrite existing file or directory. The copy operation will ignore errors
* if you set this to false and the destination exists. Use the errorOnExist
* option to change this behavior. Default: true.
*/
force?: boolean;
/**
* Integer, modifiers for copy operation. Default: 0. See mode flag of
* `fs.copyFileSync()`.
*/
mode?: number;
/** When true timestamps from src will be preserved. Default: false. */
preserveTimestamps?: boolean;
/** Copy directories recursively Default: false. */
recursive?: boolean;
/** When true, path resolution for symlinks will be skipped. Default: false. */
verbatimSymlinks?: boolean;
}
export interface IStafsOptions {
/** Whether the numeric values in the returned `StatFs` object should be bigint. */
bigint?: boolean;
}
export interface IOpenAsBlobOptions {
/** An optional mime type for the blob. */
type?: string;
}
export interface IGlobOptions {
/** Current working directory. */
cwd?: string | URL;
/** Exclude patterns. */
exclude?: string | string[];
/** Maximum search depth. */
maxdepth?: number;
/** Whether to include symbolic links. */
withFileTypes?: boolean;
}
export interface IOpendirOptions extends IOptions {
/**
* Number of directory entries that are buffered internally when reading from
* the directory. Higher values lead to better performance but higher memory
* usage. Default: 32.
*/
bufferSize?: number;
/** Default: false. */
recursive?: boolean;
}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=options.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/types/options.ts"],"names":[],"mappings":""}
+88
View File
@@ -0,0 +1,88 @@
{
"name": "@jsonjoy.com/fs-node-utils",
"publishConfig": {
"access": "public"
},
"version": "4.57.1",
"description": "Utility functions for Node.js fs module",
"author": {
"name": "streamich",
"url": "https://github.com/streamich"
},
"homepage": "https://github.com/streamich/memfs/tree/master/packages/fs-node-utils",
"repository": "streamich/memfs",
"license": "Apache-2.0",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/streamich"
},
"keywords": [
"node",
"fs",
"filesystem",
"types",
"typescript",
"definitions",
"type definitions",
"node types",
"node fs",
"node filesystem",
"utils",
"utilities"
],
"engines": {
"node": ">=10.0"
},
"main": "lib/index.js",
"types": "lib/index.d.ts",
"typings": "lib/index.d.ts",
"files": [
"LICENSE",
"lib/"
],
"scripts": {
"clean": "rimraf lib typedocs coverage gh-pages yarn-error.log",
"build": "tsc --project tsconfig.build.json --module commonjs --target es2020 --outDir lib",
"jest": "node -r ts-node/register ./node_modules/.bin/jest",
"test": "jest --maxWorkers 7",
"test:ci": "yarn jest --maxWorkers 3 --no-cache",
"coverage": "yarn test --collectCoverage",
"typedoc": "typedoc",
"typecheck": "tsc -p ."
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"moduleFileExtensions": [
"ts",
"js",
"tsx"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"transformIgnorePatterns": [
".*/node_modules/.*"
],
"testRegex": ".*/(__tests__|__jest__|demo)/.*\\.(test|spec)\\.tsx?$",
"rootDir": ".",
"testPathIgnorePatterns": [
"node_modules"
]
},
"devDependencies": {
"@types/jest": "^29.0.0",
"@types/node": "^20.0.0",
"jest": "^29.0.0",
"rimraf": "^5.0.0",
"ts-jest": "^29.4.2",
"ts-node": "^10.9.2",
"typescript": "^5.9.2"
},
"peerDependencies": {
"tslib": "2"
},
"dependencies": {
"@jsonjoy.com/fs-node-builtins": "4.57.1"
}
}