aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/chownr
diff options
context:
space:
mode:
authorpack <pack@packgekko.xyz>2026-08-09 10:37:07 +0000
committerpack <pack@packgekko.xyz>2026-08-09 10:37:07 +0000
commit55a4f1fc869e41aca748c63d3018f0448b1606e0 (patch)
treed132d1d01772b6d53faee3e63c534dea5706b78a /node_modules/chownr
downloadcrud-55a4f1fc869e41aca748c63d3018f0448b1606e0.tar.gz
first commit
Diffstat (limited to 'node_modules/chownr')
-rw-r--r--node_modules/chownr/LICENSE.md63
-rw-r--r--node_modules/chownr/README.md3
-rw-r--r--node_modules/chownr/dist/commonjs/index.d.ts3
-rw-r--r--node_modules/chownr/dist/commonjs/index.js93
-rw-r--r--node_modules/chownr/dist/commonjs/package.json3
-rw-r--r--node_modules/chownr/dist/esm/index.d.ts3
-rw-r--r--node_modules/chownr/dist/esm/index.js85
-rw-r--r--node_modules/chownr/dist/esm/package.json3
-rw-r--r--node_modules/chownr/package.json69
9 files changed, 325 insertions, 0 deletions
diff --git a/node_modules/chownr/LICENSE.md b/node_modules/chownr/LICENSE.md
new file mode 100644
index 0000000..881248b
--- /dev/null
+++ b/node_modules/chownr/LICENSE.md
@@ -0,0 +1,63 @@
+All packages under `src/` are licensed according to the terms in
+their respective `LICENSE` or `LICENSE.md` files.
+
+The remainder of this project is licensed under the Blue Oak
+Model License, as follows:
+
+-----
+
+# Blue Oak Model License
+
+Version 1.0.0
+
+## Purpose
+
+This license gives everyone as much permission to work with
+this software as possible, while protecting contributors
+from liability.
+
+## Acceptance
+
+In order to receive this license, you must agree to its
+rules. The rules of this license are both obligations
+under that agreement and conditions to your license.
+You must not do anything with this software that triggers
+a rule that you cannot or will not follow.
+
+## Copyright
+
+Each contributor licenses you to do everything with this
+software that would otherwise infringe that contributor's
+copyright in it.
+
+## Notices
+
+You must ensure that everyone who gets a copy of
+any part of this software from you, with or without
+changes, also gets the text of this license or a link to
+<https://blueoakcouncil.org/license/1.0.0>.
+
+## Excuse
+
+If anyone notifies you in writing that you have not
+complied with [Notices](#notices), you can keep your
+license by taking all practical steps to comply within 30
+days after the notice. If you do not do so, your license
+ends immediately.
+
+## Patent
+
+Each contributor licenses you to do everything with this
+software that would otherwise infringe any patent claims
+they can license or become able to license.
+
+## Reliability
+
+No contributor can revoke this license.
+
+## No Liability
+
+***As far as the law allows, this software comes as is,
+without any warranty or condition, and no contributor
+will be liable to anyone for any damages related to this
+software or this license, under any kind of legal claim.***
diff --git a/node_modules/chownr/README.md b/node_modules/chownr/README.md
new file mode 100644
index 0000000..70e9a54
--- /dev/null
+++ b/node_modules/chownr/README.md
@@ -0,0 +1,3 @@
+Like `chown -R`.
+
+Takes the same arguments as `fs.chown()`
diff --git a/node_modules/chownr/dist/commonjs/index.d.ts b/node_modules/chownr/dist/commonjs/index.d.ts
new file mode 100644
index 0000000..5ab081f
--- /dev/null
+++ b/node_modules/chownr/dist/commonjs/index.d.ts
@@ -0,0 +1,3 @@
+export declare const chownr: (p: string, uid: number, gid: number, cb: (er?: unknown) => any) => void;
+export declare const chownrSync: (p: string, uid: number, gid: number) => void;
+//# sourceMappingURL=index.d.ts.map \ No newline at end of file
diff --git a/node_modules/chownr/dist/commonjs/index.js b/node_modules/chownr/dist/commonjs/index.js
new file mode 100644
index 0000000..6a7b68d
--- /dev/null
+++ b/node_modules/chownr/dist/commonjs/index.js
@@ -0,0 +1,93 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.chownrSync = exports.chownr = void 0;
+const node_fs_1 = __importDefault(require("node:fs"));
+const node_path_1 = __importDefault(require("node:path"));
+const lchownSync = (path, uid, gid) => {
+ try {
+ return node_fs_1.default.lchownSync(path, uid, gid);
+ }
+ catch (er) {
+ if (er?.code !== 'ENOENT')
+ throw er;
+ }
+};
+const chown = (cpath, uid, gid, cb) => {
+ node_fs_1.default.lchown(cpath, uid, gid, er => {
+ // Skip ENOENT error
+ cb(er && er?.code !== 'ENOENT' ? er : null);
+ });
+};
+const chownrKid = (p, child, uid, gid, cb) => {
+ if (child.isDirectory()) {
+ (0, exports.chownr)(node_path_1.default.resolve(p, child.name), uid, gid, (er) => {
+ if (er)
+ return cb(er);
+ const cpath = node_path_1.default.resolve(p, child.name);
+ chown(cpath, uid, gid, cb);
+ });
+ }
+ else {
+ const cpath = node_path_1.default.resolve(p, child.name);
+ chown(cpath, uid, gid, cb);
+ }
+};
+const chownr = (p, uid, gid, cb) => {
+ node_fs_1.default.readdir(p, { withFileTypes: true }, (er, children) => {
+ // any error other than ENOTDIR or ENOTSUP means it's not readable,
+ // or doesn't exist. give up.
+ if (er) {
+ if (er.code === 'ENOENT')
+ return cb();
+ else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')
+ return cb(er);
+ }
+ if (er || !children.length)
+ return chown(p, uid, gid, cb);
+ let len = children.length;
+ let errState = null;
+ const then = (er) => {
+ /* c8 ignore start */
+ if (errState)
+ return;
+ /* c8 ignore stop */
+ if (er)
+ return cb((errState = er));
+ if (--len === 0)
+ return chown(p, uid, gid, cb);
+ };
+ for (const child of children) {
+ chownrKid(p, child, uid, gid, then);
+ }
+ });
+};
+exports.chownr = chownr;
+const chownrKidSync = (p, child, uid, gid) => {
+ if (child.isDirectory())
+ (0, exports.chownrSync)(node_path_1.default.resolve(p, child.name), uid, gid);
+ lchownSync(node_path_1.default.resolve(p, child.name), uid, gid);
+};
+const chownrSync = (p, uid, gid) => {
+ let children;
+ try {
+ children = node_fs_1.default.readdirSync(p, { withFileTypes: true });
+ }
+ catch (er) {
+ const e = er;
+ if (e?.code === 'ENOENT')
+ return;
+ else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP')
+ return lchownSync(p, uid, gid);
+ else
+ throw e;
+ }
+ for (const child of children) {
+ chownrKidSync(p, child, uid, gid);
+ }
+ return lchownSync(p, uid, gid);
+};
+exports.chownrSync = chownrSync;
+//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/node_modules/chownr/dist/commonjs/package.json b/node_modules/chownr/dist/commonjs/package.json
new file mode 100644
index 0000000..5bbefff
--- /dev/null
+++ b/node_modules/chownr/dist/commonjs/package.json
@@ -0,0 +1,3 @@
+{
+ "type": "commonjs"
+}
diff --git a/node_modules/chownr/dist/esm/index.d.ts b/node_modules/chownr/dist/esm/index.d.ts
new file mode 100644
index 0000000..5ab081f
--- /dev/null
+++ b/node_modules/chownr/dist/esm/index.d.ts
@@ -0,0 +1,3 @@
+export declare const chownr: (p: string, uid: number, gid: number, cb: (er?: unknown) => any) => void;
+export declare const chownrSync: (p: string, uid: number, gid: number) => void;
+//# sourceMappingURL=index.d.ts.map \ No newline at end of file
diff --git a/node_modules/chownr/dist/esm/index.js b/node_modules/chownr/dist/esm/index.js
new file mode 100644
index 0000000..5c28152
--- /dev/null
+++ b/node_modules/chownr/dist/esm/index.js
@@ -0,0 +1,85 @@
+import fs from 'node:fs';
+import path from 'node:path';
+const lchownSync = (path, uid, gid) => {
+ try {
+ return fs.lchownSync(path, uid, gid);
+ }
+ catch (er) {
+ if (er?.code !== 'ENOENT')
+ throw er;
+ }
+};
+const chown = (cpath, uid, gid, cb) => {
+ fs.lchown(cpath, uid, gid, er => {
+ // Skip ENOENT error
+ cb(er && er?.code !== 'ENOENT' ? er : null);
+ });
+};
+const chownrKid = (p, child, uid, gid, cb) => {
+ if (child.isDirectory()) {
+ chownr(path.resolve(p, child.name), uid, gid, (er) => {
+ if (er)
+ return cb(er);
+ const cpath = path.resolve(p, child.name);
+ chown(cpath, uid, gid, cb);
+ });
+ }
+ else {
+ const cpath = path.resolve(p, child.name);
+ chown(cpath, uid, gid, cb);
+ }
+};
+export const chownr = (p, uid, gid, cb) => {
+ fs.readdir(p, { withFileTypes: true }, (er, children) => {
+ // any error other than ENOTDIR or ENOTSUP means it's not readable,
+ // or doesn't exist. give up.
+ if (er) {
+ if (er.code === 'ENOENT')
+ return cb();
+ else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')
+ return cb(er);
+ }
+ if (er || !children.length)
+ return chown(p, uid, gid, cb);
+ let len = children.length;
+ let errState = null;
+ const then = (er) => {
+ /* c8 ignore start */
+ if (errState)
+ return;
+ /* c8 ignore stop */
+ if (er)
+ return cb((errState = er));
+ if (--len === 0)
+ return chown(p, uid, gid, cb);
+ };
+ for (const child of children) {
+ chownrKid(p, child, uid, gid, then);
+ }
+ });
+};
+const chownrKidSync = (p, child, uid, gid) => {
+ if (child.isDirectory())
+ chownrSync(path.resolve(p, child.name), uid, gid);
+ lchownSync(path.resolve(p, child.name), uid, gid);
+};
+export const chownrSync = (p, uid, gid) => {
+ let children;
+ try {
+ children = fs.readdirSync(p, { withFileTypes: true });
+ }
+ catch (er) {
+ const e = er;
+ if (e?.code === 'ENOENT')
+ return;
+ else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP')
+ return lchownSync(p, uid, gid);
+ else
+ throw e;
+ }
+ for (const child of children) {
+ chownrKidSync(p, child, uid, gid);
+ }
+ return lchownSync(p, uid, gid);
+};
+//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/node_modules/chownr/dist/esm/package.json b/node_modules/chownr/dist/esm/package.json
new file mode 100644
index 0000000..3dbc1ca
--- /dev/null
+++ b/node_modules/chownr/dist/esm/package.json
@@ -0,0 +1,3 @@
+{
+ "type": "module"
+}
diff --git a/node_modules/chownr/package.json b/node_modules/chownr/package.json
new file mode 100644
index 0000000..09aa6b2
--- /dev/null
+++ b/node_modules/chownr/package.json
@@ -0,0 +1,69 @@
+{
+ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
+ "name": "chownr",
+ "description": "like `chown -R`",
+ "version": "3.0.0",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/isaacs/chownr.git"
+ },
+ "files": [
+ "dist"
+ ],
+ "devDependencies": {
+ "@types/node": "^20.12.5",
+ "mkdirp": "^3.0.1",
+ "prettier": "^3.2.5",
+ "rimraf": "^5.0.5",
+ "tap": "^18.7.2",
+ "tshy": "^1.13.1",
+ "typedoc": "^0.25.12"
+ },
+ "scripts": {
+ "prepare": "tshy",
+ "pretest": "npm run prepare",
+ "test": "tap",
+ "preversion": "npm test",
+ "postversion": "npm publish",
+ "prepublishOnly": "git push origin --follow-tags",
+ "format": "prettier --write . --loglevel warn",
+ "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
+ },
+ "license": "BlueOak-1.0.0",
+ "engines": {
+ "node": ">=18"
+ },
+ "tshy": {
+ "exports": {
+ "./package.json": "./package.json",
+ ".": "./src/index.ts"
+ }
+ },
+ "exports": {
+ "./package.json": "./package.json",
+ ".": {
+ "import": {
+ "types": "./dist/esm/index.d.ts",
+ "default": "./dist/esm/index.js"
+ },
+ "require": {
+ "types": "./dist/commonjs/index.d.ts",
+ "default": "./dist/commonjs/index.js"
+ }
+ }
+ },
+ "main": "./dist/commonjs/index.js",
+ "types": "./dist/commonjs/index.d.ts",
+ "type": "module",
+ "prettier": {
+ "semi": false,
+ "printWidth": 75,
+ "tabWidth": 2,
+ "useTabs": false,
+ "singleQuote": true,
+ "jsxSingleQuote": false,
+ "bracketSameLine": true,
+ "arrowParens": "avoid",
+ "endOfLine": "lf"
+ }
+}