@gjsify/fs 0.64.12-next.280 → 0.64.12

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.
Files changed (2) hide show
  1. package/lib/esm/callback.js +1 -1
  2. package/package.json +10 -11
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{normalizePath as e}from"./utils.js";import{createNodeError as t,requireCallback as n}from"./errors.js";import{STAT_ATTRIBUTES as r,statsFrom as i}from"./stats.js";import{FileHandle as a}from"./file-handle.js";import{accessSync as o,appendFileSync as s,chmodSync as c,chownSync as l,copyFileSync as u,linkSync as d,mkdirSync as f,mkdtempSync as p,readFileSync as m,readdirSync as h,readlinkSync as g,realpathSync as _,renameSync as v,rmdirSync as y,truncateSync as b,writeFileSync as x}from"./sync.js";import{open as S,rm as C}from"./promises.js";import w from"@girs/glib-2.0";import T from"@girs/gio-2.0";import{Buffer as E}from"node:buffer";function withHandle(e,t,n){try{return a.getInstance(e,t)}catch(e){return Promise.resolve().then(()=>n(e)),null}}function parseOptsCb(e,t){return typeof e==`function`?{options:{},callback:e}:{options:e??{},callback:n(t)}}function statImpl(n,a,o,s,c){let l=e(n),u=T.File.new_for_path(l);u.query_info_async(r,a,w.PRIORITY_DEFAULT,null,(e,n)=>{try{c(null,i(u.query_info_finish(n),l,o,s?.bigint))}catch(e){c(t(e,o,l))}})}function stat(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);statImpl(e,T.FileQueryInfoFlags.NONE,`stat`,r,i)}function lstat(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);statImpl(e,T.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,`lstat`,r,i)}function readdir(e,n,r){let{options:i,callback:a}=parseOptsCb(n,r);Promise.resolve().then(()=>{try{a(null,h(e,i))}catch(n){a(t(n,`readdir`,e))}})}function realpath(e,t,n){let{callback:r}=parseOptsCb(t,n);Promise.resolve().then(()=>{try{r(null,_(e))}catch(e){r(e)}})}function symlink(r,i,a,o){let s=typeof a==`function`?a:n(o);if(typeof s!=`function`)throw TypeError(`Callback must be a function. Received `+typeof s);let c=e(i),l=e(r),u=T.File.new_for_path(c);u.make_symbolic_link_async(l,w.PRIORITY_DEFAULT,null,(e,n)=>{try{u.make_symbolic_link_finish(n),s(null)}catch(e){s(t(e,`symlink`,l,c))}})}function open(e,...t){let r,i,a;switch(t.length){case 1:a=t[0];break;case 2:r=t[0],a=t[1];break;case 3:r=t[0],i=t[1],a=t[2];break;default:break}let o=n(a);S(e,r,i).then(e=>{o(null,e.fd)}).catch(e=>{o(e,-1)})}function write(e,t,...r){n(r[r.length-1]);let i=withHandle(e,`write`,e=>{let n=r[r.length-1];typeof t==`string`?n(e,0,``):n(e,0,E.from([]))});if(!i)return;if(typeof t==`string`){let e=r.pop(),n=r[0],a=r[1];i.write(t,n,a).then(t=>{e(null,t.bytesWritten,t.buffer)}).catch(t=>{e(t,0,``)});return}let a=r[r.length-1],o=r[0],s=r[1],c=r[2];i.write(t,o,s,c).then(e=>{a(null,e.bytesWritten,e.buffer)}).catch(e=>{a(e,0,E.from([]))})}function read(e,...t){let r=n(t[t.length-1]),i=withHandle(e,`read`,e=>{typeof r==`function`&&r(e,0,E.from([]))});if(!i)return;let a,o,s,c;if(!(t.length<=1))if(typeof t[0]==`object`&&!ArrayBuffer.isView(t[0])){let e=t[0];a=e.buffer,o=e.offset,s=e.length,c=e.position}else a=t[0],o=t[1],s=t[2],c=t[3];i.read(a,o,s,c).then(e=>{r(null,e.bytesRead,e.buffer)}).catch(e=>{r(e,0,E.from([]))})}function close(e,t){let done=e=>{typeof t==`function`&&t(e)},n=withHandle(e,`close`,done);n&&n.close().then(()=>done(null)).catch(e=>done(e))}function rm(e,...t){let n={},r=t[t.length-1];t.length>=2&&(n=t[0]),C(e,n).then(()=>{r(null)}).catch(e=>{r(e)})}function rename(e,t,r){n(r),Promise.resolve().then(()=>{try{v(e,t),r(null)}catch(e){r(e)}})}function copyFile(e,t,r,i){let a=typeof r==`function`?0:r,o=typeof r==`function`?r:n(i);Promise.resolve().then(()=>{try{u(e,t,a),o(null)}catch(e){o(e)}})}function access(e,t,r){let i=typeof t==`function`?void 0:t,a=typeof t==`function`?t:n(r);Promise.resolve().then(()=>{try{o(e,i),a(null)}catch(e){a(e)}})}function appendFile(e,t,r,i){let a=typeof r==`function`?r:n(i),o=typeof r==`function`?void 0:r;Promise.resolve().then(()=>{try{s(e,t,o),a(null)}catch(e){a(e)}})}function readlink(e,t,r){let i=typeof t==`function`?t:n(r),a=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{i(null,g(e,a))}catch(e){i(e,``)}})}function truncate(e,t,r){let i=typeof t==`function`?0:t,a=typeof t==`function`?t:n(r);Promise.resolve().then(()=>{try{b(e,i),a(null)}catch(e){a(e)}})}function chmod(e,t,r){n(r),Promise.resolve().then(()=>{try{c(e,t),r(null)}catch(e){r(e)}})}function chown(e,t,r,i){n(i),Promise.resolve().then(()=>{try{l(e,t,r),i(null)}catch(e){i(e)}})}function mkdir(e,t,r){let i=typeof t==`function`?t:n(r),a=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{f(e,a),i(null)}catch(e){i(e)}})}function mkdtemp(e,t,r){let i=typeof t==`function`?t:n(r),a=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{let t;try{t=p(e,a)}catch(e){i(e,void 0);return}i(null,t)})}function rmdir(e,t,r){let i=typeof t==`function`?t:n(r),a=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{y(e,a),i(null)}catch(e){i(e)}})}function readFile(e,t,r){let i=typeof t==`function`?t:n(r),a=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{let t=typeof a==`string`?{encoding:a,flag:`r`}:{encoding:a?.encoding??null,flag:a?.flag??`r`};i(null,m(e,t))}catch(e){i(e,null)}})}function writeFile(e,t,r,i){let a=typeof r==`function`?r:n(i),o=typeof r==`function`?void 0:r;Promise.resolve().then(()=>{try{x(e,t,o),a(null)}catch(e){a(e)}})}function link(e,t,r){n(r),Promise.resolve().then(()=>{try{d(e,t),r(null)}catch(e){r(e)}})}function unlink(t,r){n(r);let i=e(t);Promise.resolve().then(()=>{w.unlink(i),r(null)})}export{access,appendFile,chmod,chown,close,copyFile,link,lstat,mkdir,mkdtemp,open,read,readFile,readdir,readlink,realpath,rename,rm,rmdir,stat,symlink,truncate,unlink,write,writeFile};
1
+ import"./_virtual/_rolldown/runtime.js";import{normalizePath as e}from"./utils.js";import{createNodeError as t,requireCallback as n}from"./errors.js";import{STAT_ATTRIBUTES as r,statsFrom as i}from"./stats.js";import{FileHandle as a}from"./file-handle.js";import{accessSync as o,appendFileSync as s,chmodSync as c,chownSync as l,copyFileSync as u,linkSync as d,mkdirSync as f,mkdtempSync as p,readFileSync as m,readdirSync as h,readlinkSync as g,realpathSync as _,renameSync as v,rmdirSync as y,truncateSync as b,writeFileSync as x}from"./sync.js";import{open as S,rm as C}from"./promises.js";import w from"@girs/glib-2.0";import T from"@girs/gio-2.0";import{Buffer as E}from"node:buffer";function withHandle(e,t,n){try{return a.getInstance(e,t)}catch(e){return Promise.resolve().then(()=>n(e)),null}}function parseOptsCb(e,t){return typeof e==`function`?{options:{},callback:e}:{options:e??{},callback:n(t)}}function statImpl(n,a,o,s,c){let l=e(n),u=T.File.new_for_path(l);u.query_info_async(r,a,w.PRIORITY_DEFAULT,null,(e,n)=>{try{c(null,i(u.query_info_finish(n),l,o,s?.bigint))}catch(e){c(t(e,o,l))}})}function stat(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);statImpl(e,T.FileQueryInfoFlags.NONE,`stat`,r,i)}function lstat(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);statImpl(e,T.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,`lstat`,r,i)}function readdir(e,n,r){let{options:i,callback:a}=parseOptsCb(n,r);Promise.resolve().then(()=>{try{a(null,h(e,i))}catch(n){a(t(n,`readdir`,e))}})}function realpath(e,t,n){let{callback:r}=parseOptsCb(t,n);Promise.resolve().then(()=>{try{r(null,_(e))}catch(e){r(e)}})}realpath.native=realpath;function symlink(r,i,a,o){let s=typeof a==`function`?a:n(o);if(typeof s!=`function`)throw TypeError(`Callback must be a function. Received `+typeof s);let c=e(i),l=e(r),u=T.File.new_for_path(c);u.make_symbolic_link_async(l,w.PRIORITY_DEFAULT,null,(e,n)=>{try{u.make_symbolic_link_finish(n),s(null)}catch(e){s(t(e,`symlink`,l,c))}})}function open(e,...t){let r,i,a;switch(t.length){case 1:a=t[0];break;case 2:r=t[0],a=t[1];break;case 3:r=t[0],i=t[1],a=t[2];break;default:break}let o=n(a);S(e,r,i).then(e=>{o(null,e.fd)}).catch(e=>{o(e,-1)})}function write(e,t,...r){n(r[r.length-1]);let i=withHandle(e,`write`,e=>{let n=r[r.length-1];typeof t==`string`?n(e,0,``):n(e,0,E.from([]))});if(!i)return;if(typeof t==`string`){let e=r.pop(),n=r[0],a=r[1];i.write(t,n,a).then(t=>{e(null,t.bytesWritten,t.buffer)}).catch(t=>{e(t,0,``)});return}let a=r[r.length-1],o=r[0],s=r[1],c=r[2];i.write(t,o,s,c).then(e=>{a(null,e.bytesWritten,e.buffer)}).catch(e=>{a(e,0,E.from([]))})}function read(e,...t){let r=n(t[t.length-1]),i=withHandle(e,`read`,e=>{typeof r==`function`&&r(e,0,E.from([]))});if(!i)return;let a,o,s,c;if(!(t.length<=1))if(typeof t[0]==`object`&&!ArrayBuffer.isView(t[0])){let e=t[0];a=e.buffer,o=e.offset,s=e.length,c=e.position}else a=t[0],o=t[1],s=t[2],c=t[3];i.read(a,o,s,c).then(e=>{r(null,e.bytesRead,e.buffer)}).catch(e=>{r(e,0,E.from([]))})}function close(e,t){let done=e=>{typeof t==`function`&&t(e)},n=withHandle(e,`close`,done);n&&n.close().then(()=>done(null)).catch(e=>done(e))}function rm(e,...t){let n={},r=t[t.length-1];t.length>=2&&(n=t[0]),C(e,n).then(()=>{r(null)}).catch(e=>{r(e)})}function rename(e,t,r){n(r),Promise.resolve().then(()=>{try{v(e,t),r(null)}catch(e){r(e)}})}function copyFile(e,t,r,i){let a=typeof r==`function`?0:r,o=typeof r==`function`?r:n(i);Promise.resolve().then(()=>{try{u(e,t,a),o(null)}catch(e){o(e)}})}function access(e,t,r){let i=typeof t==`function`?void 0:t,a=typeof t==`function`?t:n(r);Promise.resolve().then(()=>{try{o(e,i),a(null)}catch(e){a(e)}})}function appendFile(e,t,r,i){let a=typeof r==`function`?r:n(i),o=typeof r==`function`?void 0:r;Promise.resolve().then(()=>{try{s(e,t,o),a(null)}catch(e){a(e)}})}function readlink(e,t,r){let i=typeof t==`function`?t:n(r),a=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{i(null,g(e,a))}catch(e){i(e,``)}})}function truncate(e,t,r){let i=typeof t==`function`?0:t,a=typeof t==`function`?t:n(r);Promise.resolve().then(()=>{try{b(e,i),a(null)}catch(e){a(e)}})}function chmod(e,t,r){n(r),Promise.resolve().then(()=>{try{c(e,t),r(null)}catch(e){r(e)}})}function chown(e,t,r,i){n(i),Promise.resolve().then(()=>{try{l(e,t,r),i(null)}catch(e){i(e)}})}function mkdir(e,t,r){let i=typeof t==`function`?t:n(r),a=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{f(e,a),i(null)}catch(e){i(e)}})}function mkdtemp(e,t,r){let i=typeof t==`function`?t:n(r),a=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{let t;try{t=p(e,a)}catch(e){i(e,void 0);return}i(null,t)})}function rmdir(e,t,r){let i=typeof t==`function`?t:n(r),a=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{y(e,a),i(null)}catch(e){i(e)}})}function readFile(e,t,r){let i=typeof t==`function`?t:n(r),a=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{let t=typeof a==`string`?{encoding:a,flag:`r`}:{encoding:a?.encoding??null,flag:a?.flag??`r`};i(null,m(e,t))}catch(e){i(e,null)}})}function writeFile(e,t,r,i){let a=typeof r==`function`?r:n(i),o=typeof r==`function`?void 0:r;Promise.resolve().then(()=>{try{x(e,t,o),a(null)}catch(e){a(e)}})}function link(e,t,r){n(r),Promise.resolve().then(()=>{try{d(e,t),r(null)}catch(e){r(e)}})}function unlink(t,r){n(r);let i=e(t);Promise.resolve().then(()=>{w.unlink(i),r(null)})}export{access,appendFile,chmod,chown,close,copyFile,link,lstat,mkdir,mkdtemp,open,read,readFile,readdir,readlink,realpath,rename,rm,rmdir,stat,symlink,truncate,unlink,write,writeFile};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/fs",
3
- "version": "0.64.12-next.280",
3
+ "version": "0.64.12",
4
4
  "description": "Node.js fs module for Gjs",
5
5
  "module": "lib/esm/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -66,9 +66,9 @@
66
66
  "fs"
67
67
  ],
68
68
  "devDependencies": {
69
- "@gjsify/cli": "0.64.12-next.280",
70
- "@gjsify/unit": "0.64.12-next.280",
71
- "@gjsify/web-streams": "0.64.12-next.280",
69
+ "@gjsify/cli": "^0.64.12",
70
+ "@gjsify/unit": "^0.64.12",
71
+ "@gjsify/web-streams": "^0.64.12",
72
72
  "@types/node": "^25.9.2",
73
73
  "typescript": "^6.0.3"
74
74
  },
@@ -76,11 +76,11 @@
76
76
  "@girs/gio-2.0": "5.4.0",
77
77
  "@girs/giounix-2.0": "5.4.0",
78
78
  "@girs/glib-2.0": "5.4.0",
79
- "@gjsify/buffer": "0.64.12-next.280",
80
- "@gjsify/events": "0.64.12-next.280",
81
- "@gjsify/stream": "0.64.12-next.280",
82
- "@gjsify/url": "0.64.12-next.280",
83
- "@gjsify/utils": "0.64.12-next.280"
79
+ "@gjsify/buffer": "^0.64.12",
80
+ "@gjsify/events": "^0.64.12",
81
+ "@gjsify/stream": "^0.64.12",
82
+ "@gjsify/url": "^0.64.12",
83
+ "@gjsify/utils": "^0.64.12"
84
84
  },
85
85
  "gjsify": {
86
86
  "runtimes": {
@@ -109,6 +109,5 @@
109
109
  "bugs": {
110
110
  "url": "https://github.com/gjsify/gjsify/issues"
111
111
  },
112
- "homepage": "https://github.com/gjsify/gjsify/tree/main/packages/node/fs#readme",
113
- "gitHead": "0a9185d91127072fce6aa54dc126e87e6ecd0c3d"
112
+ "homepage": "https://github.com/gjsify/gjsify/tree/main/packages/node/fs#readme"
114
113
  }